<html>
<head><meta charset="utf-8"><title>Inline const expressions #77124 · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html">Inline const expressions #77124</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="210928610"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210928610" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210928610">(Sep 22 2020 at 20:41)</a>:</h4>
<p>I was trying a huge hack :)</p>



<a name="210928880"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210928880" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210928880">(Sep 22 2020 at 20:44)</a>:</h4>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="w">    </span><span class="sd">/// Parses constness: `const` or nothing.</span>
<span class="w">    </span><span class="k">fn</span> <span class="nf">parse_constness</span><span class="p">(</span><span class="o">&amp;</span><span class="k">mut</span><span class="w"> </span><span class="bp">self</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">Const</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="k">if</span><span class="w"> </span><span class="p">(</span><span class="o">!</span><span class="bp">self</span><span class="p">.</span><span class="n">sess</span><span class="p">.</span><span class="n">unstable_features</span><span class="p">.</span><span class="n">inline_const</span><span class="w"></span>
<span class="w">            </span><span class="o">||</span><span class="w"> </span><span class="bp">self</span><span class="p">.</span><span class="n">look_ahead</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span><span class="w"> </span><span class="o">|</span><span class="n">t</span><span class="o">|</span><span class="w"> </span><span class="n">t</span><span class="w"> </span><span class="o">!=</span><span class="w"> </span><span class="o">&amp;</span><span class="n">token</span>::<span class="n">OpenDelim</span><span class="p">(</span><span class="n">DelimToken</span>::<span class="n">Brace</span><span class="p">)))</span><span class="w"></span>
<span class="w">            </span><span class="o">&amp;&amp;</span><span class="w"> </span><span class="bp">self</span><span class="p">.</span><span class="n">eat_keyword</span><span class="p">(</span><span class="n">kw</span>::<span class="n">Const</span><span class="p">)</span><span class="w"></span>
<span class="w">        </span><span class="p">{</span><span class="w"></span>
<span class="w">            </span><span class="n">Const</span>::<span class="n">Yes</span><span class="p">(</span><span class="bp">self</span><span class="p">.</span><span class="n">prev_token</span><span class="p">.</span><span class="n">uninterpolated_span</span><span class="p">())</span><span class="w"></span>
<span class="w">        </span><span class="p">}</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">            </span><span class="n">Const</span>::<span class="n">No</span><span class="w"></span>
<span class="w">        </span><span class="p">}</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="210928929"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210928929" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210928929">(Sep 22 2020 at 20:44)</a>:</h4>
<p><span class="user-mention" data-user-id="123856">@Vadim Petrochenkov</span> btw, <code>self.sess.unstable_features.inline_const</code> doesn't work I was checking how to do that</p>



<a name="210928965"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210928965" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210928965">(Sep 22 2020 at 20:45)</a>:</h4>
<p>but modifying <code>parse_constness</code> in that way is not the way to go I guess</p>



<a name="210929005"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210929005" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210929005">(Sep 22 2020 at 20:45)</a>:</h4>
<p>aren't we only building unstable_features here</p>



<a name="210929013"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210929013" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210929013">(Sep 22 2020 at 20:45)</a>:</h4>
<p>as we first have to parse the feature annotations</p>



<a name="210929140"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210929140" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210929140">(Sep 22 2020 at 20:46)</a>:</h4>
<p><span class="user-mention" data-user-id="216206">@lcnr</span> sorry didn't get what you meant exactly</p>



<a name="210929781"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210929781" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210929781">(Sep 22 2020 at 20:52)</a>:</h4>
<p>yeah, was some distracted rn</p>



<a name="210929871"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210929871" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210929871">(Sep 22 2020 at 20:53)</a>:</h4>
<blockquote>
<p>self.sess.unstable_features.inline_const doesn't work</p>
</blockquote>
<p>What I meant to say is that I expect this to not work as we have to parse a crate to know which unstable features are active</p>



<a name="210930003"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210930003" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210930003">(Sep 22 2020 at 20:54)</a>:</h4>
<p>yeah that doesn't work but what I wonder is how do you check if the feature flag is on to "change" what the parser does?</p>



<a name="210930039"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210930039" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210930039">(Sep 22 2020 at 20:55)</a>:</h4>
<p>I'd expect the parser to be affected only if <code>#![feature(inline_const)]</code></p>



<a name="210930403"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210930403" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210930403">(Sep 22 2020 at 20:58)</a>:</h4>
<p>Hmm, I don't think this is possible (once again noting that I am not an expert here)</p>



<a name="210930433"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210930433" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210930433">(Sep 22 2020 at 20:58)</a>:</h4>
<p>users can't rely on these parser changes without activating that feature though, as we emit a feature error for the <code>gated_spans</code></p>



<a name="210930482"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210930482" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210930482">(Sep 22 2020 at 20:59)</a>:</h4>
<p><span aria-label="+1" class="emoji emoji-1f44d" role="img" title="+1">:+1:</span></p>



<a name="210930736"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210930736" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210930736">(Sep 22 2020 at 21:01)</a>:</h4>
<p><span class="user-mention silent" data-user-id="123856">Vadim Petrochenkov</span> <a href="#narrow/stream/131828-t-compiler/topic/Inline.20const.20expressions/near/210928525">said</a>:</p>
<blockquote>
<p><code>parse_stmt_without_recovery</code> looks like a good candidate for this disambiguation.<br>
Things like <code>union U { ... }</code> vs <code>union { ... }</code> are already disambiguated there.</p>
</blockquote>
<p>by looking at the code I don't understand how there is that disambiguated</p>



<a name="210931196"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210931196" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210931196">(Sep 22 2020 at 21:06)</a>:</h4>
<p>I guess we may be talking about <a href="https://github.com/rust-lang/rust/blob/29bdcd5575614ad9df1ae5c0c026d750aad235db/compiler/rustc_parse/src/parser/item.rs#L212">https://github.com/rust-lang/rust/blob/29bdcd5575614ad9df1ae5c0c026d750aad235db/compiler/rustc_parse/src/parser/item.rs#L212</a></p>



<a name="210931225"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210931225" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210931225">(Sep 22 2020 at 21:06)</a>:</h4>
<p>which for const end in <a href="https://github.com/rust-lang/rust/blob/29bdcd5575614ad9df1ae5c0c026d750aad235db/compiler/rustc_parse/src/parser/item.rs#L246">https://github.com/rust-lang/rust/blob/29bdcd5575614ad9df1ae5c0c026d750aad235db/compiler/rustc_parse/src/parser/item.rs#L246</a></p>



<a name="210931228"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210931228" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210931228">(Sep 22 2020 at 21:06)</a>:</h4>
<p>in <code>is_path_start_item</code></p>



<a name="210931248"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210931248" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210931248">(Sep 22 2020 at 21:07)</a>:</h4>
<p>we check for <code>kw ident</code></p>



<a name="210931304"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210931304" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210931304">(Sep 22 2020 at 21:07)</a>:</h4>
<p>I see</p>



<a name="210931362"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210931362" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210931362">(Sep 22 2020 at 21:08)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/blob/e0bc267512fc0cb49c86978192857e8187017f0b/compiler/rustc_parse/src/parser/stmt.rs#L51">https://github.com/rust-lang/rust/blob/e0bc267512fc0cb49c86978192857e8187017f0b/compiler/rustc_parse/src/parser/stmt.rs#L51</a></p>



<a name="210931405"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210931405" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210931405">(Sep 22 2020 at 21:08)</a>:</h4>
<p>I would expect us to add a branch here above that one</p>



<a name="210932153"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210932153" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210932153">(Sep 22 2020 at 21:14)</a>:</h4>
<p>right</p>



<a name="210932157"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210932157" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210932157">(Sep 22 2020 at 21:14)</a>:</h4>
<p>I wasn't doing exactly that</p>



<a name="210932163"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210932163" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210932163">(Sep 22 2020 at 21:14)</a>:</h4>
<p>was adding it below</p>



<a name="210932168"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210932168" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210932168">(Sep 22 2020 at 21:15)</a>:</h4>
<p>I think it's the same</p>



<a name="210932203"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210932203" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210932203">(Sep 22 2020 at 21:15)</a>:</h4>
<p>but neither below because I guess we want to reuse what's done later</p>



<a name="210932220"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210932220" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210932220">(Sep 22 2020 at 21:15)</a>:</h4>
<p>well I guess it's easier to explain with a diff :)</p>



<a name="210932322"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210932322" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210932322">(Sep 22 2020 at 21:16)</a>:</h4>
<p>(I just forgot that <code>const</code> is not a conditional keyword)</p>



<a name="210932334"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210932334" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210932334">(Sep 22 2020 at 21:16)</a>:</h4>
<p>go ahead <span aria-label="laughing" class="emoji emoji-1f606" role="img" title="laughing">:laughing:</span></p>



<a name="210932495"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210932495" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210932495">(Sep 22 2020 at 21:18)</a>:</h4>
<p>I'm right now fighting with the fact that I can't do <code>if !self.check_inline_const() &amp;&amp; let Some(item) = ... </code></p>



<a name="210932511"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210932511" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210932511">(Sep 22 2020 at 21:18)</a>:</h4>
<p>:P</p>



<a name="210932688"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210932688" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210932688">(Sep 22 2020 at 21:20)</a>:</h4>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">if</span><span class="w"> </span><span class="kd">let</span><span class="w"> </span><span class="nb">Some</span><span class="p">(</span><span class="n">v</span><span class="p">)</span><span class="w">  </span><span class="o">=</span><span class="w"> </span><span class="n">maybe_item</span><span class="p">.</span><span class="n">filter</span><span class="p">(</span><span class="o">|</span><span class="n">_</span><span class="o">|</span><span class="w"> </span><span class="o">!</span><span class="bp">self</span><span class="p">.</span><span class="n">check_inline_const</span><span class="p">())</span><span class="w"></span>
</code></pre></div>



<a name="210932706"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210932706" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210932706">(Sep 22 2020 at 21:20)</a>:</h4>
<p>if you need a oneliner <span aria-label="laughing" class="emoji emoji-1f606" role="img" title="laughing">:laughing:</span></p>



<a name="210932737"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210932737" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210932737">(Sep 22 2020 at 21:20)</a>:</h4>
<p>the problem is that once I have done maybe_item things are consumed</p>



<a name="210932760"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210932760" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210932760">(Sep 22 2020 at 21:20)</a>:</h4>
<p>I'd need something like this ...</p>



<a name="210932765"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210932765" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210932765">(Sep 22 2020 at 21:20)</a>:</h4>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="w">        </span><span class="p">}</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="bp">self</span><span class="p">.</span><span class="n">check_inline_const</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">            </span><span class="kd">let</span><span class="w"> </span><span class="n">e</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="bp">self</span><span class="p">.</span><span class="n">parse_expr_res</span><span class="p">(</span><span class="n">Restrictions</span>::<span class="n">STMT_EXPR</span><span class="p">,</span><span class="w"> </span><span class="nb">Some</span><span class="p">(</span><span class="n">attrs</span><span class="p">.</span><span class="n">into</span><span class="p">()))</span><span class="o">?</span><span class="p">;</span><span class="w"></span>
<span class="w">            </span><span class="bp">self</span><span class="p">.</span><span class="n">mk_stmt</span><span class="p">(</span><span class="n">lo</span><span class="p">.</span><span class="n">to</span><span class="p">(</span><span class="n">e</span><span class="p">.</span><span class="n">span</span><span class="p">),</span><span class="w"> </span><span class="n">StmtKind</span>::<span class="n">Expr</span><span class="p">(</span><span class="n">e</span><span class="p">))</span><span class="w"></span>
<span class="w">        </span><span class="p">}</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="kd">let</span><span class="w"> </span><span class="nb">Some</span><span class="p">(</span><span class="n">item</span><span class="p">)</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="bp">self</span><span class="p">.</span><span class="n">parse_item_common</span><span class="p">(</span><span class="n">attrs</span><span class="p">.</span><span class="n">clone</span><span class="p">(),</span><span class="w"> </span><span class="kc">false</span><span class="p">,</span><span class="w"> </span><span class="kc">true</span><span class="p">,</span><span class="w"> </span><span class="o">|</span><span class="n">_</span><span class="o">|</span><span class="w"> </span><span class="kc">true</span><span class="p">)</span><span class="o">?</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">            </span><span class="c1">// FIXME: Bad copy of attrs</span>
<span class="w">            </span><span class="bp">self</span><span class="p">.</span><span class="n">mk_stmt</span><span class="p">(</span><span class="n">lo</span><span class="p">.</span><span class="n">to</span><span class="p">(</span><span class="n">item</span><span class="p">.</span><span class="n">span</span><span class="p">),</span><span class="w"> </span><span class="n">StmtKind</span>::<span class="n">Item</span><span class="p">(</span><span class="n">P</span><span class="p">(</span><span class="n">item</span><span class="p">)))</span><span class="w"></span>
<span class="w">        </span><span class="p">}</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="bp">self</span><span class="p">.</span><span class="n">eat</span><span class="p">(</span><span class="o">&amp;</span><span class="n">token</span>::<span class="n">Semi</span><span class="p">)</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">            </span><span class="c1">// Do not attempt to parse an expression if we're done here.</span>
<span class="w">            </span><span class="bp">self</span><span class="p">.</span><span class="n">error_outer_attrs</span><span class="p">(</span><span class="o">&amp;</span><span class="n">attrs</span><span class="p">);</span><span class="w"></span>
<span class="w">            </span><span class="bp">self</span><span class="p">.</span><span class="n">mk_stmt</span><span class="p">(</span><span class="n">lo</span><span class="p">,</span><span class="w"> </span><span class="n">StmtKind</span>::<span class="n">Empty</span><span class="p">)</span><span class="w"></span>
<span class="w">        </span><span class="p">}</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="bp">self</span><span class="p">.</span><span class="n">token</span><span class="w"> </span><span class="o">!=</span><span class="w"> </span><span class="n">token</span>::<span class="n">CloseDelim</span><span class="p">(</span><span class="n">token</span>::<span class="n">Brace</span><span class="p">)</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">            </span><span class="c1">// Remainder are line-expr stmts.</span>
<span class="w">            </span><span class="kd">let</span><span class="w"> </span><span class="n">e</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="bp">self</span><span class="p">.</span><span class="n">parse_expr_res</span><span class="p">(</span><span class="n">Restrictions</span>::<span class="n">STMT_EXPR</span><span class="p">,</span><span class="w"> </span><span class="nb">Some</span><span class="p">(</span><span class="n">attrs</span><span class="p">.</span><span class="n">into</span><span class="p">()))</span><span class="o">?</span><span class="p">;</span><span class="w"></span>
<span class="w">            </span><span class="bp">self</span><span class="p">.</span><span class="n">mk_stmt</span><span class="p">(</span><span class="n">lo</span><span class="p">.</span><span class="n">to</span><span class="p">(</span><span class="n">e</span><span class="p">.</span><span class="n">span</span><span class="p">),</span><span class="w"> </span><span class="n">StmtKind</span>::<span class="n">Expr</span><span class="p">(</span><span class="n">e</span><span class="p">))</span><span class="w"></span>
<span class="w">        </span><span class="p">}</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">            </span><span class="bp">self</span><span class="p">.</span><span class="n">error_outer_attrs</span><span class="p">(</span><span class="o">&amp;</span><span class="n">attrs</span><span class="p">);</span><span class="w"></span>
<span class="w">            </span><span class="k">return</span><span class="w"> </span><span class="nb">Ok</span><span class="p">(</span><span class="nb">None</span><span class="p">);</span><span class="w"></span>
<span class="w">        </span><span class="p">};</span><span class="w"></span>
</code></pre></div>



<a name="210932790"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210932790" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210932790">(Sep 22 2020 at 21:21)</a>:</h4>
<p>but as you can see the 1st block is identical to the 4th</p>



<a name="210932845"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210932845" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210932845">(Sep 22 2020 at 21:22)</a>:</h4>
<p>there are a ton of ways to sort this out, maybe better to extract functions but things that I'm being lazy to do :P</p>



<a name="210933077"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210933077" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210933077">(Sep 22 2020 at 21:24)</a>:</h4>
<p>why <code>parse_expr_res</code> instead of <code>parse_block</code>?</p>



<a name="210933096"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210933096" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210933096">(Sep 22 2020 at 21:24)</a>:</h4>
<p>but I don't know if I am actually helping here</p>



<a name="210933114"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210933114" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210933114">(Sep 22 2020 at 21:24)</a>:</h4>
<p>mostly guess work from my side <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span></p>



<a name="210933223"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210933223" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210933223">(Sep 22 2020 at 21:25)</a>:</h4>
<p>your guessing + my guessing is more likely to do something useful than just my poor guessing <span aria-label="joy" class="emoji emoji-1f602" role="img" title="joy">:joy:</span></p>



<a name="210933982"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210933982" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210933982">(Sep 22 2020 at 21:33)</a>:</h4>
<p><span class="user-mention silent" data-user-id="216206">lcnr</span> <a href="#narrow/stream/131828-t-compiler/topic/Inline.20const.20expressions/near/210933077">said</a>:</p>
<blockquote>
<p>why <code>parse_expr_res</code> instead of <code>parse_block</code>?</p>
</blockquote>
<p>just in case, I think you're right</p>



<a name="210933992"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210933992" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210933992">(Sep 22 2020 at 21:33)</a>:</h4>
<p>I need to move the code from where it was</p>



<a name="210934093"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210934093" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210934093">(Sep 22 2020 at 21:34)</a>:</h4>
<p>probably my approach is right too but it will execute a ton more code than what's needed</p>



<a name="210935522"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210935522" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210935522">(Sep 22 2020 at 21:47)</a>:</h4>
<p><span class="user-mention" data-user-id="216206">@lcnr</span> I'm having some doubts about the spans now</p>



<a name="210935602"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210935602" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210935602">(Sep 22 2020 at 21:48)</a>:</h4>
<p>?</p>



<a name="210935621"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210935621" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210935621">(Sep 22 2020 at 21:48)</a>:</h4>
<p>I'm about to test everything out</p>



<a name="210935633"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210935633" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210935633">(Sep 22 2020 at 21:48)</a>:</h4>
<p>but unsure if how spans are handled there are correct <a href="https://github.com/rust-lang/rust/compare/master...spastorino:const-exprs-rfc-2920#diff-2704c05ef6fd8b0d46631f5b5618e8e4R57-R66">https://github.com/rust-lang/rust/compare/master...spastorino:const-exprs-rfc-2920#diff-2704c05ef6fd8b0d46631f5b5618e8e4R57-R66</a></p>



<a name="210935709"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210935709" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210935709">(Sep 22 2020 at 21:49)</a>:</h4>
<p>4 spans are used there and I'm not sure if those are entirely right</p>



<a name="210935720"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210935720" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210935720">(Sep 22 2020 at 21:49)</a>:</h4>
<p>gonna check exactly how <code>to</code> behaves</p>



<a name="210935794"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210935794" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210935794">(Sep 22 2020 at 21:50)</a>:</h4>
<p>for instance, without the feature flag this parse</p>



<a name="210935803"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210935803" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210935803">(Sep 22 2020 at 21:50)</a>:</h4>
<p>which I guess is not expected</p>



<a name="210935837"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210935837" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210935837">(Sep 22 2020 at 21:50)</a>:</h4>
<p>you have to add a feature check</p>



<a name="210935864"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210935864" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210935864">(Sep 22 2020 at 21:50)</a>:</h4>
<p>let me get the correct location</p>



<a name="210935930"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210935930" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210935930">(Sep 22 2020 at 21:51)</a>:</h4>
<p>ahh I thought <code>self.sess.gated_spans.gate(sym::inline_const, const_span);</code> was checking</p>



<a name="210935952"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210935952" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210935952">(Sep 22 2020 at 21:51)</a>:</h4>
<p>no, we have to explicitly check these spans</p>



<a name="210935999"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210935999" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210935999">(Sep 22 2020 at 21:52)</a>:</h4>
<p>ohh it's pushing :)</p>



<a name="210936015"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210936015" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210936015">(Sep 22 2020 at 21:52)</a>:</h4>
<p>grep gate_all!(half_open_range_patterns, "half-open range patterns are unstable");</p>



<a name="210936029"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210936029" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210936029">(Sep 22 2020 at 21:52)</a>:</h4>
<p>but for instance, unsure if that span is</p>



<a name="210936058"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210936058" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210936058">(Sep 22 2020 at 21:52)</a>:</h4>
<p><code>lo.to(self.token.span)</code> or just <code>self.token.span</code></p>



<a name="210936093"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210936093" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210936093">(Sep 22 2020 at 21:53)</a>:</h4>
<p>I think self.token.span would be <code>{</code> here</p>



<a name="210936120"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210936120" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210936120">(Sep 22 2020 at 21:53)</a>:</h4>
<p>so <code>lo.to(self.token.span)</code> looks correct to me</p>



<a name="210936142"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210936142" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210936142">(Sep 22 2020 at 21:53)</a>:</h4>
<p>lo it's <code>const</code>'s span?</p>



<a name="210936205"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210936205" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210936205">(Sep 22 2020 at 21:54)</a>:</h4>
<p>lo is </p>
<div class="codehilite"><pre><span></span><code>const {
^^^^^
</code></pre></div>



<a name="210936213"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210936213" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210936213">(Sep 22 2020 at 21:54)</a>:</h4>
<p>oh no, it's not</p>



<a name="210936220"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210936220" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210936220">(Sep 22 2020 at 21:54)</a>:</h4>
<p>really</p>



<a name="210936226"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210936226" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210936226">(Sep 22 2020 at 21:54)</a>:</h4>
<p>or well I believe it's not</p>



<a name="210936233"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210936233" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210936233">(Sep 22 2020 at 21:54)</a>:</h4>
<p>what's the output <span aria-label="sweat smile" class="emoji emoji-1f605" role="img" title="sweat smile">:sweat_smile:</span></p>



<a name="210936271"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210936271" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210936271">(Sep 22 2020 at 21:55)</a>:</h4>
<p>sorry I'm wrong, it's const</p>



<a name="210936315"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210936315" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210936315">(Sep 22 2020 at 21:55)</a>:</h4>
<p>and what to does?</p>



<a name="210936322"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210936322" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210936322">(Sep 22 2020 at 21:55)</a>:</h4>
<p>something that encloses both</p>



<a name="210936324"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210936324" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210936324">(Sep 22 2020 at 21:55)</a>:</h4>
<p>ok ok</p>



<a name="210936332"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210936332" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210936332">(Sep 22 2020 at 21:56)</a>:</h4>
<p>makes sense :)</p>



<a name="210936492"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210936492" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210936492">(Sep 22 2020 at 21:57)</a>:</h4>
<p>i give it up (my zulip doesn't use fixed width characters)</p>



<a name="210936586"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210936586" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210936586">(Sep 22 2020 at 21:58)</a>:</h4>
<p>I wouldn't worry about the spans for now</p>



<a name="210936603"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210936603" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210936603">(Sep 22 2020 at 21:58)</a>:</h4>
<p>we can always adjust them later, once we have working tests</p>



<a name="210937756"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210937756" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210937756">(Sep 22 2020 at 22:10)</a>:</h4>
<p><span class="user-mention" data-user-id="216206">@lcnr</span> <span aria-label="+1" class="emoji emoji-1f44d" role="img" title="+1">:+1:</span></p>



<a name="210937800"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210937800" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210937800">(Sep 22 2020 at 22:10)</a>:</h4>
<p>need to leave and have pushed but it doesn't seem to work</p>



<a name="210937823"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210937823" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210937823">(Sep 22 2020 at 22:10)</a>:</h4>
<p>I meant, it parses the thing but I'm not sure why without the feature flag it doesn't fail</p>



<a name="210937831"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210937831" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210937831">(Sep 22 2020 at 22:10)</a>:</h4>
<p>I need to investigate it better</p>



<a name="210937848"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210937848" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210937848">(Sep 22 2020 at 22:10)</a>:</h4>
<p><span class="user-mention silent" data-user-id="216206">lcnr</span> <a href="#narrow/stream/131828-t-compiler/topic/Inline.20const.20expressions/near/210936015">said</a>:</p>
<blockquote>
<p>grep gate_all!(half_open_range_patterns, "half-open range patterns are unstable");</p>
</blockquote>
<p>did you do that?</p>



<a name="210937859"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210937859" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210937859">(Sep 22 2020 at 22:10)</a>:</h4>
<p>and add a line for <code>inline_consts</code> there</p>



<a name="210937991"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210937991" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210937991">(Sep 22 2020 at 22:12)</a>:</h4>
<p>yep, have done that and pushed</p>



<a name="210938244"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210938244" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210938244">(Sep 22 2020 at 22:15)</a>:</h4>
<p>maybe <code>parse-only</code> doesn't actually run the pass responsible for emitting feature errors <span aria-label="laughing" class="emoji emoji-1f606" role="img" title="laughing">:laughing:</span></p>



<a name="210938315"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210938315" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210938315">(Sep 22 2020 at 22:16)</a>:</h4>
<p>if we stop before then we won't emit any errors</p>



<a name="210938905"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210938905" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210938905">(Sep 22 2020 at 22:24)</a>:</h4>
<p>possibly <span aria-label="blush" class="emoji emoji-1f60a" role="img" title="blush">:blush:</span></p>



<a name="210941698"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210941698" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210941698">(Sep 22 2020 at 23:01)</a>:</h4>
<p><span class="user-mention" data-user-id="216206">@lcnr</span> just got the computer again for a minute and tried ...</p>



<a name="210941706"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210941706" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210941706">(Sep 22 2020 at 23:01)</a>:</h4>
<div class="codehilite"><pre><span></span><code>[santiago@galago rust3 (const-exprs-rfc-2920)]$ rustc +rust3-stage1 src/test/ui/parser/inline_const.rs
thread &#39;rustc&#39; panicked at &#39;not implemented&#39;, compiler/rustc_ast_lowering/src/expr.rs:34:21
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&amp;template=ice.md

note: rustc 1.48.0-dev running on x86_64-unknown-linux-gnu

[santiago@galago rust3 (const-exprs-rfc-2920)]$ vim src/test/ui/parser/inline_const.rs
[santiago@galago rust3 (const-exprs-rfc-2920)]$ rustc +rust3-stage1 src/test/ui/parser/inline_const.rs
error[E0658]: inline-const is experimental
 --&gt; src/test/ui/parser/inline_const.rs:6:5
  |
6 |     const {
  |     ^^^^^^^
  |
  = note: see issue #76001 &lt;https://github.com/rust-lang/rust/issues/76001&gt; for more information
  = help: add `#![feature(inline_const)]` to the crate attributes to enable

thread &#39;rustc&#39; panicked at &#39;not implemented&#39;, compiler/rustc_ast_lowering/src/expr.rs:34:21
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&amp;template=ice.md

note: rustc 1.48.0-dev running on x86_64-unknown-linux-gnu

error: aborting due to previous error

For more information about this error, try `rustc --explain E0658`.
</code></pre></div>



<a name="210941714"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/210941714" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#210941714">(Sep 22 2020 at 23:02)</a>:</h4>
<p>which looks exactly right :)</p>



<a name="211045803"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211045803" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211045803">(Sep 23 2020 at 18:46)</a>:</h4>
<p>do we need to adjust <code>PatKind</code> in any way?</p>



<a name="211045815"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211045815" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211045815">(Sep 23 2020 at 18:46)</a>:</h4>
<p>cc <span class="user-mention" data-user-id="118594">@ecstatic-morse</span></p>



<a name="211045843"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211045843" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211045843">(Sep 23 2020 at 18:46)</a>:</h4>
<p>ohh I see it on the RFC</p>



<a name="211045854"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211045854" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211045854">(Sep 23 2020 at 18:46)</a>:</h4>
<p>yeah, I think we do</p>



<a name="211046022"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211046022" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dylan MacKenzie (ecstatic-morse) <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211046022">(Sep 23 2020 at 18:48)</a>:</h4>
<p>Yes.  If you like, you can work on just the expression variant for now, but making it parse shouldn't be too hard.</p>



<a name="211046192"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211046192" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211046192">(Sep 23 2020 at 18:49)</a>:</h4>
<p>right</p>



<a name="211051618"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211051618" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211051618">(Sep 23 2020 at 19:31)</a>:</h4>
<p>just in case, what's really accepted there</p>



<a name="211051621"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211051621" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211051621">(Sep 23 2020 at 19:31)</a>:</h4>
<p><code>const { expr }</code></p>



<a name="211051641"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211051641" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211051641">(Sep 23 2020 at 19:31)</a>:</h4>
<p>in particular, <code>expr</code> would need to be a "literal" I guess?</p>



<a name="211051829"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211051829" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211051829">(Sep 23 2020 at 19:33)</a>:</h4>
<p>ahh no, it seems like the same block of code would be valid too</p>



<a name="211054245"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211054245" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211054245">(Sep 23 2020 at 19:55)</a>:</h4>
<p>Yea, const blocks are the same everywhere</p>



<a name="211054280"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211054280" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211054280">(Sep 23 2020 at 19:56)</a>:</h4>
<p>That will cause ppl to write humongous patterns... but <span aria-label="shrug" class="emoji emoji-1f937" role="img" title="shrug">:shrug:</span></p>



<a name="211055174"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211055174" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211055174">(Sep 23 2020 at 20:03)</a>:</h4>
<p>hehe :)</p>



<a name="211058900"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211058900" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211058900">(Sep 23 2020 at 20:36)</a>:</h4>
<div class="codehilite"><pre><span></span><code>[santiago@galago rust3 (const-exprs-rfc-2920)]$ rustc src/test/ui/parser/keyword-const-as-identifier.rs
error: expected identifier, found keyword `const`
 --&gt; src/test/ui/parser/keyword-const-as-identifier.rs:4:9
  |
4 |     let const = &quot;foo&quot;; //~ error: expected identifier, found keyword `const`
  |         ^^^^^ expected identifier, found keyword
  |
help: you can escape reserved keywords to use them as identifiers
  |
4 |     let r#const = &quot;foo&quot;; //~ error: expected identifier, found keyword `const`
  |         ^^^^^^^

error: aborting due to previous error
</code></pre></div>



<a name="211058902"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211058902" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211058902">(Sep 23 2020 at 20:36)</a>:</h4>
<p>vs</p>



<a name="211058914"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211058914" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211058914">(Sep 23 2020 at 20:36)</a>:</h4>
<div class="codehilite"><pre><span></span><code>[santiago@galago rust3 (const-exprs-rfc-2920)]$ rustc +rust3-stage1 src/test/ui/parser/keyword-const-as-identifier.rs
error: expected `{`, found `=`
 --&gt; src/test/ui/parser/keyword-const-as-identifier.rs:4:15
  |
4 |     let const = &quot;foo&quot;; //~ error: expected identifier, found keyword `const`
  |               ^ expected `{`

error[E0658]: inline-const is experimental
 --&gt; src/test/ui/parser/keyword-const-as-identifier.rs:4:9
  |
4 |     let const = &quot;foo&quot;; //~ error: expected identifier, found keyword `const`
  |         ^^^^^^^
  |
  = note: see issue #76001 &lt;https://github.com/rust-lang/rust/issues/76001&gt; for more information
  = help: add `#![feature(inline_const)]` to the crate attributes to enable

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0658`.
</code></pre></div>



<a name="211058948"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211058948" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211058948">(Sep 23 2020 at 20:37)</a>:</h4>
<p>I guess it is expected that the error changes</p>



<a name="211058984"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211058984" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211058984">(Sep 23 2020 at 20:37)</a>:</h4>
<p>because we would not accept <code>const</code> as a pattern</p>



<a name="211059117"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211059117" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211059117">(Sep 23 2020 at 20:38)</a>:</h4>
<p>in that case, I guess that test should be removed and I can add proper tests to handle a pattern there</p>



<a name="211061335"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211061335" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dylan MacKenzie (ecstatic-morse) <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211061335">(Sep 23 2020 at 20:57)</a>:</h4>
<p>You probably want to fall-back to parsing a simple named binding if you see anything besides <code>{</code> after <code>const</code> in a pattern..</p>



<a name="211061375"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211061375" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211061375">(Sep 23 2020 at 20:58)</a>:</h4>
<p>I was going to say that</p>



<a name="211061414"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211061414" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211061414">(Sep 23 2020 at 20:58)</a>:</h4>
<p>yeah</p>



<a name="211061428"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211061428" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211061428">(Sep 23 2020 at 20:58)</a>:</h4>
<p>still that test should go away</p>



<a name="211061509"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211061509" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dylan MacKenzie (ecstatic-morse) <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211061509">(Sep 23 2020 at 20:59)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116266">Santiago Pastorino</span> <a href="#narrow/stream/131828-t-compiler/topic/Inline.20const.20expressions/near/211061428">said</a>:</p>
<blockquote>
<p>still that test should go away</p>
</blockquote>
<p>Why?</p>



<a name="211061543"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211061543" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211061543">(Sep 23 2020 at 20:59)</a>:</h4>
<p>is testing that <code>let const = ...</code> is wrong</p>



<a name="211061552"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211061552" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211061552">(Sep 23 2020 at 20:59)</a>:</h4>
<p>Can <code>const {</code> just mirror what <code>unsafe {</code> and <code>async {</code> do?<br>
Then if we want make some improvements to error recovery, we'll do that for all of them.</p>



<a name="211061577"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211061577" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211061577">(Sep 23 2020 at 20:59)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116266">Santiago Pastorino</span> <a href="#narrow/stream/131828-t-compiler/topic/Inline.20const.20expressions/near/211061543">said</a>:</p>
<blockquote>
<p>is testing that <code>let const = ...</code> is wrong</p>
</blockquote>
<p>but now you should be able to do <code>let const { pattern } = something</code></p>



<a name="211061976"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211061976" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211061976">(Sep 23 2020 at 21:03)</a>:</h4>
<p><span class="user-mention silent" data-user-id="123856">Vadim Petrochenkov</span> <a href="#narrow/stream/131828-t-compiler/topic/Inline.20const.20expressions/near/211061552">said</a>:</p>
<blockquote>
<p>Can <code>const {</code> just mirror what <code>unsafe {</code> and <code>async {</code> do?<br>
Then if we want make some improvements to error recovery, we'll do that for all of them.</p>
</blockquote>
<p>we're talking about patterns</p>



<a name="211062012"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211062012" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211062012">(Sep 23 2020 at 21:03)</a>:</h4>
<p>how would mirror <code>unsafe</code> or <code>async</code> be in that context?</p>



<a name="211063540"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211063540" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211063540">(Sep 23 2020 at 21:18)</a>:</h4>
<p>Ah, patterns.<br>
<span class="user-mention silent" data-user-id="116266">Santiago Pastorino</span> <a href="#narrow/stream/131828-t-compiler/topic/Inline.20const.20expressions/near/211062012">said</a>:</p>
<blockquote>
<p>how would mirror <code>unsafe</code> or <code>async</code> be in that context?</p>
</blockquote>
<p>Anyway, the answer is mostly likely "by not doing anything special and just reporting the generic unexpected token error", because <code>unsafe {</code> and <code>async {</code> don't do any special recovery in expressions either, AFAIK.</p>



<a name="211063824"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211063824" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211063824">(Sep 23 2020 at 21:20)</a>:</h4>
<p><span class="user-mention" data-user-id="123856">@Vadim Petrochenkov</span> sorry because my english is terrible, hehe, but I'm not following  you</p>



<a name="211063844"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211063844" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211063844">(Sep 23 2020 at 21:21)</a>:</h4>
<p>just in case to check if we are on the same page</p>



<a name="211063851"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211063851" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211063851">(Sep 23 2020 at 21:21)</a>:</h4>
<p>we want to support <code>const</code> in patterns</p>



<a name="211063940"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211063940" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211063940">(Sep 23 2020 at 21:22)</a>:</h4>
<p>for instance</p>



<a name="211063942"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211063942" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211063942">(Sep 23 2020 at 21:22)</a>:</h4>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">match</span><span class="w"> </span><span class="n">read_mmio</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="mi">0</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="p">{}</span><span class="w"></span>
<span class="w">        </span><span class="k">const</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="mi">1</span><span class="w"> </span><span class="o">&lt;&lt;</span><span class="w"> </span><span class="n">MMIO_BIT1</span><span class="w"> </span><span class="p">}</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="n">println</span><span class="o">!</span><span class="p">(</span><span class="s">"FOO"</span><span class="p">),</span><span class="w"></span>
<span class="w">        </span><span class="k">const</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="mi">1</span><span class="w"> </span><span class="o">&lt;&lt;</span><span class="w"> </span><span class="n">MMIO_BIT2</span><span class="w"> </span><span class="p">}</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="n">println</span><span class="o">!</span><span class="p">(</span><span class="s">"BAR"</span><span class="p">),</span><span class="w"></span>

<span class="w">        </span><span class="n">_</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="n">unreachable</span><span class="o">!</span><span class="p">(),</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="211064010"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211064010" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211064010">(Sep 23 2020 at 21:23)</a>:</h4>
<p>but I'm still wondering what would be valid there ... I guess inside <code>const { }</code> we would be accepting a sub pattern</p>



<a name="211064030"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211064030" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211064030">(Sep 23 2020 at 21:23)</a>:</h4>
<p>and basically any sub pattern would be valid</p>



<a name="211064325"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211064325" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211064325">(Sep 23 2020 at 21:26)</a>:</h4>
<p>I guess even this is valid ...</p>



<a name="211064331"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211064331" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211064331">(Sep 23 2020 at 21:26)</a>:</h4>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">match</span><span class="w"> </span><span class="n">something</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="k">const</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">          </span><span class="kd">let</span><span class="w"> </span><span class="n">x</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">1</span><span class="w"> </span><span class="o">&lt;&lt;</span><span class="w"> </span><span class="mi">3</span><span class="p">;</span><span class="w"></span>
<span class="w">          </span><span class="kd">let</span><span class="w"> </span><span class="n">y</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">1</span><span class="w"> </span><span class="o">&lt;&lt;</span><span class="w"> </span><span class="mi">5</span><span class="p">;</span><span class="w"></span>
<span class="w">          </span><span class="n">foo</span>::<span class="n">Bar</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">x</span><span class="p">,</span><span class="w"> </span><span class="n">y</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
<span class="w">        </span><span class="p">}</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="n">println</span><span class="o">!</span><span class="p">(</span><span class="s">"BAR"</span><span class="p">),</span><span class="w"></span>
<span class="w">        </span><span class="n">z</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="n">println</span><span class="o">!</span><span class="p">(</span><span class="s">"FOO"</span><span class="p">),</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="211064394"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211064394" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211064394">(Sep 23 2020 at 21:27)</a>:</h4>
<p>That's not at all how I understood it</p>



<a name="211064468"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211064468" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211064468">(Sep 23 2020 at 21:27)</a>:</h4>
<p>The body of the const block in a pattern is an expression just like with const blocks in expression position</p>



<a name="211064561"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211064561" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211064561">(Sep 23 2020 at 21:28)</a>:</h4>
<p><span class="user-mention silent" data-user-id="124288">oli</span> <a href="#narrow/stream/131828-t-compiler/topic/Inline.20const.20expressions/near/211064468">said</a>:</p>
<blockquote>
<p>The body of the const block in a pattern is an expression just like with const blocks in expression position</p>
</blockquote>
<p>right</p>



<a name="211064573"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211064573" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211064573">(Sep 23 2020 at 21:28)</a>:</h4>
<p>So your example would still work</p>



<a name="211064677"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211064677" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211064677">(Sep 23 2020 at 21:30)</a>:</h4>
<p>The <code>let const =</code> test should still fail to parse, but the error would now be on the <code>=</code> instead of on the <code>const</code></p>



<a name="211064870"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211064870" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211064870">(Sep 23 2020 at 21:31)</a>:</h4>
<p><span class="user-mention silent" data-user-id="124288">oli</span> <a href="#narrow/stream/131828-t-compiler/topic/Inline.20const.20expressions/near/211064677">said</a>:</p>
<blockquote>
<p>The <code>let const =</code> test should still fail to parse, but the error would now be on the <code>=</code> instead of on the <code>const</code></p>
</blockquote>
<p>right</p>



<a name="211064877"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211064877" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211064877">(Sep 23 2020 at 21:31)</a>:</h4>
<p>that's what happens if I'm not wrong</p>



<a name="211064897"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211064897" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211064897">(Sep 23 2020 at 21:31)</a>:</h4>
<p>Yea, that error looks good</p>



<a name="211064902"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211064902" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211064902">(Sep 23 2020 at 21:31)</a>:</h4>
<p>but the test was really about testing that const is not an ident so I guess we don't want it</p>



<a name="211064958"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211064958" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211064958">(Sep 23 2020 at 21:32)</a>:</h4>
<p>Though the second one is rather confusing xD</p>



<a name="211064972"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211064972" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211064972">(Sep 23 2020 at 21:32)</a>:</h4>
<p>(The second error)</p>



<a name="211064994"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211064994" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211064994">(Sep 23 2020 at 21:32)</a>:</h4>
<p>that's because the feature flag is not on</p>



<a name="211065040"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211065040" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211065040">(Sep 23 2020 at 21:33)</a>:</h4>
<p>You should be able to just change the test to using <code>struct const;</code>, but I think keeping the existing test is good because it shows us the error that happens on stable</p>



<a name="211065335"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211065335" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211065335">(Sep 23 2020 at 21:36)</a>:</h4>
<p>maybe I should open a WIP PR and we can start discussing this over the concrete code and changes ?</p>



<a name="211065744"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211065744" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211065744">(Sep 23 2020 at 21:40)</a>:</h4>
<p>Wfm, but also these are all details that are probably irrelevant for an MVP. We can always add more PRs later</p>



<a name="211065795"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211065795" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211065795">(Sep 23 2020 at 21:41)</a>:</h4>
<p>We've merged PRs before that just added parser support and ICEd the compiler when you actually used the feature</p>



<a name="211065809"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211065809" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211065809">(Sep 23 2020 at 21:41)</a>:</h4>
<p>So take whatever step size you feel comfortable with</p>



<a name="211065933"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211065933" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211065933">(Sep 23 2020 at 21:43)</a>:</h4>
<p>hehe :)</p>



<a name="211065976"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211065976" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211065976">(Sep 23 2020 at 21:43)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/issues/77124">#77124</a></p>



<a name="211066083"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211066083" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211066083">(Sep 23 2020 at 21:44)</a>:</h4>
<p><span class="user-mention" data-user-id="124288">@oli</span> there you will see the test removed but please comment saying whatever you prefer to be done with it</p>



<a name="211185438"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211185438" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211185438">(Sep 24 2020 at 20:26)</a>:</h4>
<p>what kind of check do we need to do here <a href="https://github.com/rust-lang/rust/blob/18712dd42a0da7d7d005132e2105f675f7ef9aff/compiler/rustc_typeck/src/check/expr.rs">https://github.com/rust-lang/rust/blob/18712dd42a0da7d7d005132e2105f675f7ef9aff/compiler/rustc_typeck/src/check/expr.rs</a> ?</p>



<a name="211185497"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211185497" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211185497">(Sep 24 2020 at 20:26)</a>:</h4>
<p>like I meant, I think we're basically type checking the expression at that point</p>



<a name="211185687"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211185687" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211185687">(Sep 24 2020 at 20:28)</a>:</h4>
<p>what I guess I'm asking is how does this work? :P</p>



<a name="211185713"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211185713" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211185713">(Sep 24 2020 at 20:28)</a>:</h4>
<p>it says read <code>mod.rs</code> checking that</p>



<a name="211185751"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211185751" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211185751">(Sep 24 2020 at 20:29)</a>:</h4>
<p>I would expect this to be the same as type checking repeat expressions</p>



<a name="211185765"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211185765" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211185765">(Sep 24 2020 at 20:29)</a>:</h4>
<p>let me find where we do that</p>



<a name="211185900"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211185900" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211185900">(Sep 24 2020 at 20:30)</a>:</h4>
<p>yeah that's what I was guessing</p>



<a name="211185903"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211185903" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211185903">(Sep 24 2020 at 20:30)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/blob/18712dd42a0da7d7d005132e2105f675f7ef9aff/compiler/rustc_typeck/src/check/expr.rs#L1025">https://github.com/rust-lang/rust/blob/18712dd42a0da7d7d005132e2105f675f7ef9aff/compiler/rustc_typeck/src/check/expr.rs#L1025</a></p>



<a name="211185968"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211185968" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211185968">(Sep 24 2020 at 20:31)</a>:</h4>
<p>but stuff like <a href="https://github.com/rust-lang/rust/blob/18712dd42a0da7d7d005132e2105f675f7ef9aff/compiler/rustc_typeck/src/check/expr.rs#L1037">https://github.com/rust-lang/rust/blob/18712dd42a0da7d7d005132e2105f675f7ef9aff/compiler/rustc_typeck/src/check/expr.rs#L1037</a> has confused me</p>



<a name="211186133"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211186133" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211186133">(Sep 24 2020 at 20:32)</a>:</h4>
<p>ohh I guess there instead of unwrapping, I should just directly use <code>uty</code>?</p>



<a name="211186290"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211186290" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211186290">(Sep 24 2020 at 20:34)</a>:</h4>
<p>yeah, I expect that that's what we want here</p>



<a name="211186659"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211186659" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211186659">(Sep 24 2020 at 20:37)</a>:</h4>
<p>and I guess <a href="https://github.com/rust-lang/rust/blob/18712dd42a0da7d7d005132e2105f675f7ef9aff/compiler/rustc_typeck/src/check/expr.rs#L1062">https://github.com/rust-lang/rust/blob/18712dd42a0da7d7d005132e2105f675f7ef9aff/compiler/rustc_typeck/src/check/expr.rs#L1062</a></p>



<a name="211186680"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211186680" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211186680">(Sep 24 2020 at 20:37)</a>:</h4>
<p>I'd need to build the expected type</p>



<a name="211186697"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211186697" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211186697">(Sep 24 2020 at 20:37)</a>:</h4>
<p>tcx.mk_ty(t)</p>



<a name="211186785"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211186785" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211186785">(Sep 24 2020 at 20:38)</a>:</h4>
<p>so either <code>uty</code> or a new inference variable</p>



<a name="211186879"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211186879" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211186879">(Sep 24 2020 at 20:39)</a>:</h4>
<p>right, yeah that's what I thought too</p>



<a name="211193261"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211193261" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211193261">(Sep 24 2020 at 21:41)</a>:</h4>
<p>now wonder what to do here <a href="https://github.com/rust-lang/rust/blob/18712dd42a0da7d7d005132e2105f675f7ef9aff/compiler/rustc_passes/src/liveness.rs#L1041">https://github.com/rust-lang/rust/blob/18712dd42a0da7d7d005132e2105f675f7ef9aff/compiler/rustc_passes/src/liveness.rs#L1041</a></p>



<a name="211193400"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211193400" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211193400">(Sep 24 2020 at 21:43)</a>:</h4>
<p>I guess we would fall in this <a href="https://github.com/rust-lang/rust/blob/18712dd42a0da7d7d005132e2105f675f7ef9aff/compiler/rustc_passes/src/liveness.rs#L1312">https://github.com/rust-lang/rust/blob/18712dd42a0da7d7d005132e2105f675f7ef9aff/compiler/rustc_passes/src/liveness.rs#L1312</a> case</p>



<a name="211196988"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211196988" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dylan MacKenzie (ecstatic-morse) <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211196988">(Sep 24 2020 at 22:25)</a>:</h4>
<p><span class="user-mention" data-user-id="116266">@Santiago Pastorino</span> I went to look at this and ended up filing  <a href="https://github.com/rust-lang/rust/issues/77169">#77169</a>.</p>
<p>For now, the HIR liveness pass should just ignore inline constants, same as it ignores the second element of <code>hir::ExprKind::Repeat</code>.</p>



<a name="211197512"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211197512" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dylan MacKenzie (ecstatic-morse) <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211197512">(Sep 24 2020 at 22:32)</a>:</h4>
<p>In the long run, we can treat them more like closure bodies, which should be correct even if they can't capture anything. Alternatively, we can spin up a new liveness checking context for each inline constant (including array length expressions).</p>



<a name="211222786"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211222786" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211222786">(Sep 25 2020 at 06:32)</a>:</h4>
<blockquote>
<p>we can spin up a new liveness checking context for each inline constant (including array length expressions).</p>
</blockquote>
<p>I don't know too much about liveness, but considering that constants are separate bodies from their outer functions, wouldn't this make more sense here?</p>



<a name="211286620"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211286620" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dylan MacKenzie (ecstatic-morse) <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211286620">(Sep 25 2020 at 17:14)</a>:</h4>
<p>Yes, that's most efficient. The first one may be easier to implement (like a few lines) since there's already precedent in closure bodies. I doubt performance of this code matters too much, and there's also <a href="https://github.com/rust-lang/rust/issues/51003">#51003</a>.</p>



<a name="211293529"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211293529" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211293529">(Sep 25 2020 at 18:10)</a>:</h4>
<p>just got back to this, but I'm checking again this <a href="https://github.com/rust-lang/rust/blob/18712dd42a0da7d7d005132e2105f675f7ef9aff/compiler/rustc_typeck/src/check/expr.rs#L1025">https://github.com/rust-lang/rust/blob/18712dd42a0da7d7d005132e2105f675f7ef9aff/compiler/rustc_typeck/src/check/expr.rs#L1025</a></p>



<a name="211293538"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211293538" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211293538">(Sep 25 2020 at 18:10)</a>:</h4>
<p>I'm not exactly sure what to do there</p>



<a name="211293566"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211293566" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211293566">(Sep 25 2020 at 18:11)</a>:</h4>
<p>I meant in the corresponding <code>check_expr_anon_const</code> function</p>



<a name="211293594"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211293594" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211293594">(Sep 25 2020 at 18:11)</a>:</h4>
<p>I'd expect this signature</p>



<a name="211293606"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211293606" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211293606">(Sep 25 2020 at 18:11)</a>:</h4>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="w">    </span><span class="k">fn</span> <span class="nf">check_expr_anon_const</span><span class="p">(</span><span class="w"></span>
<span class="w">        </span><span class="o">&amp;</span><span class="bp">self</span><span class="p">,</span><span class="w"></span>
<span class="w">        </span><span class="n">anon_const</span>: <span class="kp">&amp;</span><span class="o">'</span><span class="na">tcx</span> <span class="nc">hir</span>::<span class="n">AnonConst</span><span class="p">,</span><span class="w"></span>
<span class="w">        </span><span class="n">expected</span>: <span class="nc">Expectation</span><span class="o">&lt;'</span><span class="na">tcx</span><span class="o">&gt;</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">Ty</span><span class="o">&lt;'</span><span class="na">tcx</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
</code></pre></div>



<a name="211293751"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211293751" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211293751">(Sep 25 2020 at 18:12)</a>:</h4>
<p>and I guess we would need to check that the type that comes out from anon_const is the type in the expected param</p>



<a name="211293755"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211293755" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211293755">(Sep 25 2020 at 18:12)</a>:</h4>
<p>?</p>



<a name="211293776"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211293776" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211293776">(Sep 25 2020 at 18:12)</a>:</h4>
<p>then not 100% sure how to do that</p>



<a name="211294418"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211294418" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dylan MacKenzie (ecstatic-morse) <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211294418">(Sep 25 2020 at 18:18)</a>:</h4>
<p>I won't be very helpful for <code>typeck</code> code. Array length expressions always have a known type: <code>usize</code>. Inline constants should have their type inferred, just like a normal block of code or closure return type.</p>



<a name="211294639"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211294639" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211294639">(Sep 25 2020 at 18:20)</a>:</h4>
<p>right</p>



<a name="211294667"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211294667" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211294667">(Sep 25 2020 at 18:20)</a>:</h4>
<p>checking what the rest of the code does ...</p>



<a name="211294749"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211294749" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211294749">(Sep 25 2020 at 18:21)</a>:</h4>
<p>there's ...</p>



<a name="211294758"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211294758" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211294758">(Sep 25 2020 at 18:21)</a>:</h4>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="w">    </span><span class="k">fn</span> <span class="nf">check_expr_eq_type</span><span class="p">(</span><span class="o">&amp;</span><span class="bp">self</span><span class="p">,</span><span class="w"> </span><span class="n">expr</span>: <span class="kp">&amp;</span><span class="o">'</span><span class="na">tcx</span> <span class="nc">hir</span>::<span class="n">Expr</span><span class="o">&lt;'</span><span class="na">tcx</span><span class="o">&gt;</span><span class="p">,</span><span class="w"> </span><span class="n">expected</span>: <span class="nc">Ty</span><span class="o">&lt;'</span><span class="na">tcx</span><span class="o">&gt;</span><span class="p">)</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
</code></pre></div>



<a name="211294777"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211294777" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211294777">(Sep 25 2020 at 18:21)</a>:</h4>
<p>I guess I may want something like that</p>



<a name="211294833"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211294833" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dylan MacKenzie (ecstatic-morse) <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211294833">(Sep 25 2020 at 18:21)</a>:</h4>
<p>That's not type inference. How do you know what the <code>expected</code> type is?</p>



<a name="211294904"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211294904" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211294904">(Sep 25 2020 at 18:22)</a>:</h4>
<p>what I'm saying is wrong :P</p>



<a name="211294963"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211294963" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211294963">(Sep 25 2020 at 18:22)</a>:</h4>
<p>that's exactly what I need to implement <span aria-label="joy" class="emoji emoji-1f602" role="img" title="joy">:joy:</span></p>



<a name="211295036"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211295036" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dylan MacKenzie (ecstatic-morse) <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211295036">(Sep 25 2020 at 18:23)</a>:</h4>
<p>Or maybe inference is already done at this point. I dunno <span aria-label="smile" class="emoji emoji-1f642" role="img" title="smile">:smile:</span>.</p>



<a name="211295315"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211295315" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211295315">(Sep 25 2020 at 18:25)</a>:</h4>
<p>from what I see most of the code there does ...</p>



<a name="211295325"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211295325" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211295325">(Sep 25 2020 at 18:25)</a>:</h4>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="w">        </span><span class="kd">let</span><span class="w"> </span><span class="p">(</span><span class="n">element_ty</span><span class="p">,</span><span class="w"> </span><span class="n">t</span><span class="p">)</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="kd">let</span><span class="w"> </span><span class="n">ExpectHasType</span><span class="p">(</span><span class="n">uty</span><span class="p">)</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">expected</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
</code></pre></div>



<a name="211295357"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211295357" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211295357">(Sep 25 2020 at 18:25)</a>:</h4>
<p>stuff like that, the expected may or may not be known I guess</p>



<a name="211295640"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211295640" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211295640">(Sep 25 2020 at 18:28)</a>:</h4>
<p>I see there's <code>check_block_with_expected</code></p>



<a name="211295921"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211295921" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dylan MacKenzie (ecstatic-morse) <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211295921">(Sep 25 2020 at 18:30)</a>:</h4>
<p>Ah, so <code>expected: Ty</code> can still be an inference variable there. My bad. Yeah, I would start with <code>check_block_with_expected</code>. I think some parts of that method will not apply to inline constants, but you may not need to worry about that yet.</p>



<a name="211296231"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211296231" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211296231">(Sep 25 2020 at 18:32)</a>:</h4>
<p><span aria-label="+1" class="emoji emoji-1f44d" role="img" title="+1">:+1:</span></p>



<a name="211296369"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211296369" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211296369">(Sep 25 2020 at 18:33)</a>:</h4>
<p><span class="user-mention" data-user-id="118594">@ecstatic-morse</span> another question is there a nice stage to cut and test things?</p>



<a name="211296395"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211296395" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211296395">(Sep 25 2020 at 18:33)</a>:</h4>
<p>like, I first did the parsing and I was able to check with <code>-Z parse-ony</code></p>



<a name="211296427"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211296427" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211296427">(Sep 25 2020 at 18:33)</a>:</h4>
<p>unsure if something like that also applies when doing AST lowering</p>



<a name="211296511"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211296511" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211296511">(Sep 25 2020 at 18:34)</a>:</h4>
<p>or exactly when does it make sense</p>



<a name="211296605"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211296605" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211296605">(Sep 25 2020 at 18:35)</a>:</h4>
<p>so parse to AST and I've done tests</p>



<a name="211296640"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211296640" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211296640">(Sep 25 2020 at 18:35)</a>:</h4>
<p>I wonder if AST to HIR makes sense to stop for tests or go directly to THIR before going to MIR</p>



<a name="211296839"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211296839" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dylan MacKenzie (ecstatic-morse) <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211296839">(Sep 25 2020 at 18:36)</a>:</h4>
<p>That's a good question. I think parsing is the main point at which you can test. I would keep each lowering step in its own commit but try to get all the way to MIR in a single PR.</p>



<a name="211297016"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211297016" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dylan MacKenzie (ecstatic-morse) <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211297016">(Sep 25 2020 at 18:38)</a>:</h4>
<p>With liberal use of <code>unimplemented!</code>/<code>todo!</code> of course.</p>



<a name="211298838"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211298838" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211298838">(Sep 25 2020 at 18:53)</a>:</h4>
<p>yeah, I'd submit a complete PR with the feature working :)</p>



<a name="211298905"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211298905" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211298905">(Sep 25 2020 at 18:53)</a>:</h4>
<p>and yeah, was thinking about the same, like doing a commit per stage but was also wondering if ast -&gt; hir is testeable, if hir -&gt; thir is testeable and so on</p>



<a name="211306932"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211306932" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211306932">(Sep 25 2020 at 19:34)</a>:</h4>
<p>was now wondering about the corresponding <code>Rvalue</code></p>



<a name="211307061"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211307061" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211307061">(Sep 25 2020 at 19:34)</a>:</h4>
<p>I guess just making an operand would be enough?</p>



<a name="211307064"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/211307064" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#211307064">(Sep 25 2020 at 19:35)</a>:</h4>
<p>like in <a href="https://github.com/rust-lang/rust/blob/18712dd42a0da7d7d005132e2105f675f7ef9aff/compiler/rustc_mir_build/src/build/expr/as_rvalue.rs#L235-L259">https://github.com/rust-lang/rust/blob/18712dd42a0da7d7d005132e2105f675f7ef9aff/compiler/rustc_mir_build/src/build/expr/as_rvalue.rs#L235-L259</a></p>



<a name="212117089"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/212117089" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#212117089">(Oct 02 2020 at 19:22)</a>:</h4>
<p><span aria-label="wave" class="emoji emoji-1f44b" role="img" title="wave">:wave:</span> at least a basic version seems to be working</p>



<a name="212117196"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/212117196" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#212117196">(Oct 02 2020 at 19:23)</a>:</h4>
<div class="codehilite"><pre><span></span><code>[santiago@galago rust3 (const-exprs-rfc-2920)]$ cat 1.rs
#![feature(inline_const)]
fn foo() -&gt; i32 {
    const {
        let x = 5 + 10;
        x / 3
    }
}

fn main() {
    println!(&quot;{}&quot;, foo());
}
[santiago@galago rust3 (const-exprs-rfc-2920)]$ rustc +rust3-stage1 1.rs
[santiago@galago rust3 (const-exprs-rfc-2920)]$ ./1
5
</code></pre></div>



<a name="212117212"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/212117212" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#212117212">(Oct 02 2020 at 19:23)</a>:</h4>
<div class="codehilite"><pre><span></span><code>[santiago@galago rust3 (const-exprs-rfc-2920)]$ cat 2.rs
#![feature(inline_const)]

const MMIO_BIT1: u8 = 4;
const MMIO_BIT2: u8 = 5;

fn main() {
    match read_mmio() {
        0 =&gt; {}
        const { 1 &lt;&lt; MMIO_BIT1 } =&gt; println!(&quot;FOO&quot;),
        const { 1 &lt;&lt; MMIO_BIT2 } =&gt; println!(&quot;BAR&quot;),

        _ =&gt; unreachable!(),
    }
}

fn read_mmio() -&gt; i32 {
    1 &lt;&lt; 5
}
[santiago@galago rust3 (const-exprs-rfc-2920)]$ rustc +rust3-stage1 2.rs
[santiago@galago rust3 (const-exprs-rfc-2920)]$ ./2
BAR
</code></pre></div>



<a name="212117433"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/212117433" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#212117433">(Oct 02 2020 at 19:25)</a>:</h4>
<div class="codehilite"><pre><span></span><code>[santiago@galago rust3 (const-exprs-rfc-2920)]$ cat 3.rs
#![feature(inline_const)]
fn foo() -&gt; i32 {
    2 * const {
        let x = 1 + 5;
        x / 2
    }
}

fn main() {
    match foo() {
        const { 6 } =&gt; println!(&quot;6&quot;),
        _ =&gt; {}
    }
}
[santiago@galago rust3 (const-exprs-rfc-2920)]$ rustc +rust3-stage1 3.rs
warning: unnecessary braces around const expression
  --&gt; 3.rs:11:15
   |
11 |         const { 6 } =&gt; println!(&quot;6&quot;),
   |               ^^^^^ help: remove these braces
   |
   = note: `#[warn(unused_braces)]` on by default

warning: 1 warning emitted

[santiago@galago rust3 (const-exprs-rfc-2920)]$ ./3
6
</code></pre></div>



<a name="212117468"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/212117468" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#212117468">(Oct 02 2020 at 19:25)</a>:</h4>
<p>note the warning there and if you do <code>const 6 =&gt; println!("6"),</code> without the braces it works without a warning</p>



<a name="212117486"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/212117486" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#212117486">(Oct 02 2020 at 19:25)</a>:</h4>
<p>but I guess that's what we want, right?</p>



<a name="212117536"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/212117536" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#212117536">(Oct 02 2020 at 19:26)</a>:</h4>
<p>cc <span class="user-mention" data-user-id="118594">@ecstatic-morse</span> <span class="user-mention" data-user-id="216206">@lcnr</span></p>



<a name="212117997"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/212117997" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#212117997">(Oct 02 2020 at 19:30)</a>:</h4>
<p>I don't think we want to allow <code>const expr</code>, afaik we only intend to allow <code>const block</code> <span aria-label="thinking" class="emoji emoji-1f914" role="img" title="thinking">:thinking:</span></p>



<a name="212118058"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/212118058" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#212118058">(Oct 02 2020 at 19:30)</a>:</h4>
<p>am I misremembering something here?</p>



<a name="212118098"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/212118098" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#212118098">(Oct 02 2020 at 19:30)</a>:</h4>
<p>did you push your most recent changes?</p>



<a name="212118202"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/212118202" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#212118202">(Oct 02 2020 at 19:31)</a>:</h4>
<p>I didn't push yet</p>



<a name="212118264"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/212118264" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#212118264">(Oct 02 2020 at 19:32)</a>:</h4>
<p>was going to clean the PR a bit and push after that</p>



<a name="212118270"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/212118270" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#212118270">(Oct 02 2020 at 19:32)</a>:</h4>
<p>also cc <span class="user-mention" data-user-id="119009">@eddyb</span></p>



<a name="212119969"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/212119969" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dylan MacKenzie (ecstatic-morse) <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#212119969">(Oct 02 2020 at 19:46)</a>:</h4>
<p>Yes. Only <code>const { ... }</code> should parse.</p>



<a name="212194346"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/212194346" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#212194346">(Oct 03 2020 at 23:12)</a>:</h4>
<p><code>+rust3-stage1</code>?</p>



<a name="212195979"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/212195979" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#212195979">(Oct 03 2020 at 23:55)</a>:</h4>
<p>probably <a href="https://rustc-dev-guide.rust-lang.org/building/how-to-build-and-run.html?highlight=rustup,link#creating-a-rustup-toolchain">https://rustc-dev-guide.rust-lang.org/building/how-to-build-and-run.html?highlight=rustup,link#creating-a-rustup-toolchain</a></p>



<a name="212196134"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/212196134" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#212196134">(Oct 03 2020 at 23:59)</a>:</h4>
<p>So you'd have something like:<br>
<code>rustup toolchain link stage1 build/&lt;host-triple&gt;/rust3-stage1</code></p>



<a name="212196213"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/212196213" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oliver <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#212196213">(Oct 04 2020 at 00:00)</a>:</h4>
<p>Is <code>rust3</code> referring to the 2021 release?</p>



<a name="212196221"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/212196221" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#212196221">(Oct 04 2020 at 00:00)</a>:</h4>
<p><code>rustc3</code> is probably the third git worktree they have</p>



<a name="212196226"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/212196226" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#212196226">(Oct 04 2020 at 00:00)</a>:</h4>
<p><a href="https://rustc-dev-guide.rust-lang.org/building/suggested.html?highlight=worktree#working-on-multiple-branches-at-the-same-time">https://rustc-dev-guide.rust-lang.org/building/suggested.html?highlight=worktree#working-on-multiple-branches-at-the-same-time</a></p>



<a name="212196236"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/212196236" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#212196236">(Oct 04 2020 at 00:00)</a>:</h4>
<p>I use <code>+stage1</code> for my main worktree and <code>+rustc2</code> for the second</p>



<a name="212196243"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/212196243" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#212196243">(Oct 04 2020 at 00:01)</a>:</h4>
<p>(since I almost never build stage 2)</p>



<a name="212196255"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/212196255" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#212196255">(Oct 04 2020 at 00:01)</a>:</h4>
<p><code>rustup toolchain link stage1 build/&lt;host-triple&gt;/stage1</code>, but otherwise yeah that looks right</p>



<a name="212218262"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/212218262" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#212218262">(Oct 04 2020 at 11:06)</a>:</h4>
<p><span class="user-mention silent" data-user-id="281739">Oliver</span> <a href="#narrow/stream/131828-t-compiler/topic/Inline.20const.20expressions/near/212194346">said</a>:</p>
<blockquote>
<p><code>+rust3-stage1</code>?</p>
</blockquote>
<p>it's called <code>rustc.2-s1</code> for me but yeah that schema looks familiar ;)</p>



<a name="212350456"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/212350456" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#212350456">(Oct 05 2020 at 20:12)</a>:</h4>
<p>ohh sorry, I've just seen this, yeah I have a bunch of git worktrees <code>rust{n}-stage1</code>, where n = worktree copy number</p>



<a name="212490795"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/212490795" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#212490795">(Oct 06 2020 at 21:52)</a>:</h4>
<p>small status update here, just have force pushed <a href="https://github.com/rust-lang/rust/issues/77124">#77124</a></p>



<a name="212490824"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/212490824" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#212490824">(Oct 06 2020 at 21:53)</a>:</h4>
<p>I've tidy up the PR and it mostly "works"</p>



<a name="212490833"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/212490833" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#212490833">(Oct 06 2020 at 21:53)</a>:</h4>
<p>I'd add more tests</p>



<a name="212490854"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/212490854" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#212490854">(Oct 06 2020 at 21:53)</a>:</h4>
<p>but what I'm not 100% sure yet are the last 2 commits</p>



<a name="212490859"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/212490859" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#212490859">(Oct 06 2020 at 21:53)</a>:</h4>
<p>so my fixes to clippy</p>



<a name="212490933"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/212490933" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#212490933">(Oct 06 2020 at 21:54)</a>:</h4>
<p>and then the lints need more work, I meant, I've fixed the lints for inline consts but I've probably broke others, I still have things to fix there</p>



<a name="212490948"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/212490948" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#212490948">(Oct 06 2020 at 21:54)</a>:</h4>
<p>the rest I guess it's mainly up for review</p>



<a name="212491006"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/212491006" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#212491006">(Oct 06 2020 at 21:55)</a>:</h4>
<p>I meant, everything is up for review :), but I'm more convinced of the rest and not that much about my clippy fixes and neither my lint changes, anyway if someone have pointers please let me know</p>



<a name="212491041"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/212491041" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#212491041">(Oct 06 2020 at 21:55)</a>:</h4>
<p>cc <span class="user-mention" data-user-id="118594">@ecstatic-morse</span> <span class="user-mention" data-user-id="216206">@lcnr</span></p>



<a name="212496151"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/212496151" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dylan MacKenzie (ecstatic-morse) <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#212496151">(Oct 06 2020 at 22:57)</a>:</h4>
<p>Left a few comments on the parsing bits. The rest looks good I think, although I can't weigh in on the changes to inference.</p>



<a name="212496274"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/212496274" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Dylan MacKenzie (ecstatic-morse) <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#212496274">(Oct 06 2020 at 22:59)</a>:</h4>
<p>I wouldn't worry too much about clippy as long as it compiles. It's not really our job to make clippy lints the best they can be; clippy devs do just fine in that department. It's mostly about not breaking the build.</p>



<a name="212496728"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/212496728" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#212496728">(Oct 06 2020 at 23:04)</a>:</h4>
<p>adding the feature gate test so that CI runs longer would be sweet :)</p>



<a name="212570064"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/212570064" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#212570064">(Oct 07 2020 at 14:54)</a>:</h4>
<p><span class="user-mention silent" data-user-id="118594">ecstatic-morse</span> <a href="#narrow/stream/131828-t-compiler/topic/Inline.20const.20expressions/near/212496151">said</a>:</p>
<blockquote>
<p>Left a few comments on the parsing bits. The rest looks good I think, although I can't weigh in on the changes to inference.</p>
</blockquote>
<p>cool, thanks, yeah I forgot about changing the parsing to not consume the const and just check for it, something that I've noticed since a while but forgot to fix, so <span aria-label="+1" class="emoji emoji-1f44d" role="img" title="+1">:+1:</span></p>



<a name="212570082"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/212570082" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#212570082">(Oct 07 2020 at 14:54)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116113">lqd</span> <a href="#narrow/stream/131828-t-compiler/topic/Inline.20const.20expressions/near/212496728">said</a>:</p>
<blockquote>
<p>adding the feature gate test so that CI runs longer would be sweet :)</p>
</blockquote>
<p>yeah, I've done that already :)</p>



<a name="212570110"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/212570110" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#212570110">(Oct 07 2020 at 14:54)</a>:</h4>
<p>I need to fix tests and fix lints</p>



<a name="212570158"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/212570158" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#212570158">(Oct 07 2020 at 14:55)</a>:</h4>
<p>and that would be all if I'm not wrong</p>



<a name="212572975"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/212572975" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#212572975">(Oct 07 2020 at 15:11)</a>:</h4>
<p><span aria-label="tada" class="emoji emoji-1f389" role="img" title="tada">:tada:</span></p>



<a name="212881863"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/212881863" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#212881863">(Oct 09 2020 at 22:24)</a>:</h4>
<p>would be nice to know what kind of cases people would like to add for this feature</p>



<a name="212881878"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/212881878" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#212881878">(Oct 09 2020 at 22:24)</a>:</h4>
<p>I'm running tests but it should be ready now I believe</p>



<a name="212912733"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/212912733" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#212912733">(Oct 10 2020 at 11:57)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116266">Santiago Pastorino</span> <a href="#narrow/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124/near/212881863">said</a>:</p>
<blockquote>
<p>would be nice to know what kind of cases people would like to add for this feature</p>
</blockquote>
<p>What do you mean by "cases"?</p>



<a name="212912741"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/212912741" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#212912741">(Oct 10 2020 at 11:57)</a>:</h4>
<p>the classical example would be something like</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">const</span><span class="w"> </span><span class="k">fn</span> <span class="nf">bar</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="kt">i32</span> <span class="p">{</span><span class="w"> </span><span class="o">..</span><span class="p">.</span><span class="w"> </span><span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">foo</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="kp">&amp;</span><span class="o">'</span><span class="nb">static</span> <span class="kt">i32</span> <span class="p">{</span><span class="w"></span>
<span class="w">  </span><span class="k">const</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="o">&amp;</span><span class="n">bar</span><span class="p">()</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="212912745"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/212912745" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#212912745">(Oct 10 2020 at 11:57)</a>:</h4>
<p>the RFC should also have some examples</p>



<a name="212912791"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/212912791" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#212912791">(Oct 10 2020 at 11:58)</a>:</h4>
<p>another example would be array inits:</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="kd">let</span><span class="w"> </span><span class="n">x</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">[</span><span class="k">const</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">Cell</span>::<span class="n">new</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span><span class="w"> </span><span class="p">};</span><span class="w"> </span><span class="mi">20</span><span class="p">];</span><span class="w"></span>
</code></pre></div>



<a name="212923963"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/212923963" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#212923963">(Oct 10 2020 at 16:49)</a>:</h4>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="kd">let</span><span class="w"> </span><span class="n">x</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">const</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">my_expr</span><span class="w"> </span><span class="p">};</span><span class="w"></span>
</code></pre></div>



<a name="212927393"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/212927393" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#212927393">(Oct 10 2020 at 17:56)</a>:</h4>
<p>Also <code>let x: &amp;'static _ = &amp;const{bar()};</code></p>



<a name="213048381"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213048381" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213048381">(Oct 12 2020 at 14:52)</a>:</h4>
<p><span class="user-mention silent" data-user-id="120791">RalfJ</span> <a href="#narrow/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124/near/212912733">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="116266">Santiago Pastorino</span> <a href="#narrow/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124/near/212881863">said</a>:</p>
<blockquote>
<p>would be nice to know what kind of cases people would like to add for this feature</p>
</blockquote>
<p>What do you mean by "cases"?</p>
</blockquote>
<p>exactly the things you all have shared :), and yeah the RFC has some examples too</p>



<a name="213048395"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213048395" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213048395">(Oct 12 2020 at 14:52)</a>:</h4>
<p>gonna add some more tests later</p>



<a name="213606433"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213606433" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213606433">(Oct 16 2020 at 19:53)</a>:</h4>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">const</span><span class="w"> </span><span class="k">fn</span> <span class="nf">bar</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="kt">i32</span> <span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">const</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="mi">2</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="mi">3</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">foo</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="kp">&amp;</span><span class="o">'</span><span class="nb">static</span> <span class="kt">i32</span> <span class="p">{</span><span class="w"></span>
<span class="w">  </span><span class="k">const</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="o">&amp;</span><span class="n">bar</span><span class="p">()</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="213606476"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213606476" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213606476">(Oct 16 2020 at 19:53)</a>:</h4>
<div class="codehilite"><pre><span></span><code>[santiago@galago rust3 (const-exprs-rfc-2920|REBASE 7/10)]$ rustc +rust3-stage1 src/test/ui/inline-const/const-expr-reference.rs
error[E0015]: calls in constants are limited to constant functions, tuple structs and tuple variants
  --&gt; src/test/ui/inline-const/const-expr-reference.rs:12:12
   |
12 |   const { &amp;bar() }
   |            ^^^^^

error: internal compiler error: compiler/rustc_mir/src/borrow_check/universal_regions.rs:768:36: cannot convert `ReErased` to a region vid

thread &#39;rustc&#39; panicked at &#39;Box&lt;Any&gt;&#39;, compiler/rustc_errors/src/lib.rs:945:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
</code></pre></div>



<a name="213606566"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213606566" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213606566">(Oct 16 2020 at 19:54)</a>:</h4>
<p>this was trying to build <span class="user-mention" data-user-id="120791">@RalfJ</span> and <span class="user-mention" data-user-id="124288">@oli</span>'s examples</p>



<a name="213606627"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213606627" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213606627">(Oct 16 2020 at 19:55)</a>:</h4>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">use</span><span class="w"> </span><span class="n">std</span>::<span class="n">cell</span>::<span class="n">Cell</span><span class="p">;</span><span class="w"></span>

<span class="cp">#![feature(inline_const)]</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">_x</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">[</span><span class="k">const</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">Cell</span>::<span class="n">new</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span><span class="w"> </span><span class="p">};</span><span class="w"> </span><span class="mi">20</span><span class="p">];</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="213606654"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213606654" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213606654">(Oct 16 2020 at 19:55)</a>:</h4>
<div class="codehilite"><pre><span></span><code>error: an inner attribute is not permitted in this context
 --&gt; src/test/ui/inline-const/const-expr-array-init.rs:5:1
  |
5 | #![feature(inline_const)]
  | ^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files. Outer attributes, like `#[test]`, annotate the item following them.

error[E0658]: inline-const is experimental
 --&gt; src/test/ui/inline-const/const-expr-array-init.rs:8:15
  |
8 |     let _x = [const { Cell::new(0) }; 20];
  |               ^^^^^
  |
  = note: see issue #76001 &lt;https://github.com/rust-lang/rust/issues/76001&gt; for more information
  = help: add `#![feature(inline_const)]` to the crate attributes to enable

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0658`.
</code></pre></div>



<a name="213606757"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213606757" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213606757">(Oct 16 2020 at 19:56)</a>:</h4>
<p>the second one should be</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="cp">#![feature(inline_const)]</span><span class="w"></span>

<span class="k">use</span><span class="w"> </span><span class="n">std</span>::<span class="n">cell</span>::<span class="n">Cell</span><span class="p">;</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">_x</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">[</span><span class="k">const</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">Cell</span>::<span class="n">new</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span><span class="w"> </span><span class="p">};</span><span class="w"> </span><span class="mi">20</span><span class="p">];</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="213606837"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213606837" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213606837">(Oct 16 2020 at 19:56)</a>:</h4>
<p>the first one is more interesting, maybe cc <span class="user-mention" data-user-id="118594">@ecstatic-morse</span> on that one <span aria-label="thinking" class="emoji emoji-1f914" role="img" title="thinking">:thinking:</span></p>



<a name="213606930"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213606930" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213606930">(Oct 16 2020 at 19:57)</a>:</h4>
<p><span class="user-mention silent" data-user-id="216206">lcnr</span> <a href="#narrow/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124/near/213606757">said</a>:</p>
<blockquote>
<p>the second one should be</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="cp">#![feature(inline_const)]</span><span class="w"></span>

<span class="k">use</span><span class="w"> </span><span class="n">std</span>::<span class="n">cell</span>::<span class="n">Cell</span><span class="p">;</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">_x</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">[</span><span class="k">const</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">Cell</span>::<span class="n">new</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span><span class="w"> </span><span class="p">};</span><span class="w"> </span><span class="mi">20</span><span class="p">];</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>

</blockquote>
<p>what did I wrote?</p>



<a name="213606957"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213606957" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213606957">(Oct 16 2020 at 19:57)</a>:</h4>
<p>ohh the feature after the use :)</p>



<a name="213607571"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213607571" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213607571">(Oct 16 2020 at 20:03)</a>:</h4>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="cp">#![feature(inline_const)]</span><span class="w"></span>

<span class="k">const</span><span class="w"> </span><span class="k">fn</span> <span class="nf">bar</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="kp">&amp;</span><span class="o">'</span><span class="nb">static</span> <span class="kt">i32</span> <span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="o">&amp;</span><span class="k">const</span><span class="p">{</span><span class="w"> </span><span class="mi">2</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="mi">3</span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">x</span>: <span class="kp">&amp;</span><span class="o">'</span><span class="nb">static</span> <span class="kt">i32</span> <span class="o">=</span><span class="w"> </span><span class="n">bar</span><span class="p">();</span><span class="w"></span>
<span class="w">    </span><span class="n">assert_eq</span><span class="o">!</span><span class="p">(</span><span class="o">&amp;</span><span class="mi">5</span><span class="p">,</span><span class="w"> </span><span class="n">x</span><span class="p">);</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="213607574"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213607574" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213607574">(Oct 16 2020 at 20:03)</a>:</h4>
<p>works</p>



<a name="213607706"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213607706" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213607706">(Oct 16 2020 at 20:04)</a>:</h4>
<p>does <code>const { bar() }</code> work?</p>



<a name="213607752"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213607752" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213607752">(Oct 16 2020 at 20:04)</a>:</h4>
<p>in the first example?, let me check</p>



<a name="213607807"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213607807" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213607807">(Oct 16 2020 at 20:05)</a>:</h4>
<p>it works</p>



<a name="213607815"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213607815" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213607815">(Oct 16 2020 at 20:05)</a>:</h4>
<p>the full example is</p>



<a name="213607822"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213607822" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213607822">(Oct 16 2020 at 20:05)</a>:</h4>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="c1">// run-pass</span>

<span class="cp">#![feature(inline_const)]</span><span class="w"></span>

<span class="k">const</span><span class="w"> </span><span class="k">fn</span> <span class="nf">bar</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="kt">i32</span> <span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">const</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="mi">2</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="mi">3</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">foo</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="kt">i32</span> <span class="p">{</span><span class="w"></span>
<span class="w">  </span><span class="k">const</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">bar</span><span class="p">()</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">assert_eq</span><span class="o">!</span><span class="p">(</span><span class="o">&amp;</span><span class="mi">5</span><span class="p">,</span><span class="w"> </span><span class="n">foo</span><span class="p">());</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">x</span>: <span class="kp">&amp;</span><span class="o">'</span><span class="nb">static</span> <span class="kt">i32</span> <span class="o">=</span><span class="w"> </span><span class="o">&amp;</span><span class="k">const</span><span class="p">{</span><span class="n">bar</span><span class="p">()};</span><span class="w"></span>
<span class="w">    </span><span class="n">assert_eq</span><span class="o">!</span><span class="p">(</span><span class="o">&amp;</span><span class="mi">5</span><span class="p">,</span><span class="w"> </span><span class="n">x</span><span class="p">);</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="213607931"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213607931" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213607931">(Oct 16 2020 at 20:06)</a>:</h4>
<p>hmm, so only <code>const { &amp;bar() }</code> emits that nonsensical error before ending with the ICEing on the cake?</p>



<a name="213607964"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213607964" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213607964">(Oct 16 2020 at 20:06)</a>:</h4>
<p>ohh sorry, let me check again if it works</p>



<a name="213607966"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213607966" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213607966">(Oct 16 2020 at 20:06)</a>:</h4>
<p>I think I've run the wrong example</p>



<a name="213608039"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213608039" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213608039">(Oct 16 2020 at 20:07)</a>:</h4>
<p>yeah it works</p>



<a name="213608080"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213608080" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213608080">(Oct 16 2020 at 20:07)</a>:</h4>
<p>so to clarify</p>



<a name="213608085"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213608085" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213608085">(Oct 16 2020 at 20:07)</a>:</h4>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="c1">// run-pass</span>

<span class="cp">#![feature(inline_const)]</span><span class="w"></span>

<span class="k">const</span><span class="w"> </span><span class="k">fn</span> <span class="nf">bar</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="kt">i32</span> <span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">const</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="mi">2</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="mi">3</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">foo</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="kt">i32</span> <span class="p">{</span><span class="w"></span>
<span class="w">  </span><span class="k">const</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">bar</span><span class="p">()</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">assert_eq</span><span class="o">!</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span><span class="w"> </span><span class="n">foo</span><span class="p">());</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">x</span>: <span class="kp">&amp;</span><span class="o">'</span><span class="nb">static</span> <span class="kt">i32</span> <span class="o">=</span><span class="w"> </span><span class="o">&amp;</span><span class="k">const</span><span class="p">{</span><span class="n">bar</span><span class="p">()};</span><span class="w"></span>
<span class="w">    </span><span class="n">assert_eq</span><span class="o">!</span><span class="p">(</span><span class="o">&amp;</span><span class="mi">5</span><span class="p">,</span><span class="w"> </span><span class="n">x</span><span class="p">);</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="213608098"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213608098" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213608098">(Oct 16 2020 at 20:08)</a>:</h4>
<p>this works</p>



<a name="213608187"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213608187" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213608187">(Oct 16 2020 at 20:08)</a>:</h4>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="c1">// run-pass</span>

<span class="cp">#![feature(inline_const)]</span><span class="w"></span>

<span class="k">const</span><span class="w"> </span><span class="k">fn</span> <span class="nf">bar</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="kt">i32</span> <span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">const</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="mi">2</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="mi">3</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">foo</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="kp">&amp;</span><span class="o">'</span><span class="nb">static</span> <span class="kt">i32</span> <span class="p">{</span><span class="w"></span>
<span class="w">  </span><span class="o">&amp;</span><span class="k">const</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">bar</span><span class="p">()</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">assert_eq</span><span class="o">!</span><span class="p">(</span><span class="o">&amp;</span><span class="mi">5</span><span class="p">,</span><span class="w"> </span><span class="n">foo</span><span class="p">());</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">x</span>: <span class="kp">&amp;</span><span class="o">'</span><span class="nb">static</span> <span class="kt">i32</span> <span class="o">=</span><span class="w"> </span><span class="o">&amp;</span><span class="k">const</span><span class="p">{</span><span class="n">bar</span><span class="p">()};</span><span class="w"></span>
<span class="w">    </span><span class="n">assert_eq</span><span class="o">!</span><span class="p">(</span><span class="o">&amp;</span><span class="mi">5</span><span class="p">,</span><span class="w"> </span><span class="n">x</span><span class="p">);</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="213608193"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213608193" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213608193">(Oct 16 2020 at 20:08)</a>:</h4>
<p>works too</p>



<a name="213608197"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213608197" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213608197">(Oct 16 2020 at 20:08)</a>:</h4>
<p>but</p>



<a name="213608238"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213608238" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213608238">(Oct 16 2020 at 20:09)</a>:</h4>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="c1">// run-pass</span>

<span class="cp">#![feature(inline_const)]</span><span class="w"></span>

<span class="k">const</span><span class="w"> </span><span class="k">fn</span> <span class="nf">bar</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="kt">i32</span> <span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">const</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="mi">2</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="mi">3</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">foo</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="kp">&amp;</span><span class="o">'</span><span class="nb">static</span> <span class="kt">i32</span> <span class="p">{</span><span class="w"></span>
<span class="w">  </span><span class="k">const</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="o">&amp;</span><span class="n">bar</span><span class="p">()</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">assert_eq</span><span class="o">!</span><span class="p">(</span><span class="o">&amp;</span><span class="mi">5</span><span class="p">,</span><span class="w"> </span><span class="n">foo</span><span class="p">());</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">x</span>: <span class="kp">&amp;</span><span class="o">'</span><span class="nb">static</span> <span class="kt">i32</span> <span class="o">=</span><span class="w"> </span><span class="o">&amp;</span><span class="k">const</span><span class="p">{</span><span class="n">bar</span><span class="p">()};</span><span class="w"></span>
<span class="w">    </span><span class="n">assert_eq</span><span class="o">!</span><span class="p">(</span><span class="o">&amp;</span><span class="mi">5</span><span class="p">,</span><span class="w"> </span><span class="n">x</span><span class="p">);</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="213608246"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213608246" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213608246">(Oct 16 2020 at 20:09)</a>:</h4>
<p>gives</p>



<a name="213608271"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213608271" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213608271">(Oct 16 2020 at 20:09)</a>:</h4>
<div class="codehilite"><pre><span></span><code>error: internal compiler error: compiler/rustc_mir/src/borrow_check/universal_regions.rs:768:36: cannot convert `ReErased` to a region vid

thread &#39;rustc&#39; panicked at &#39;Box&lt;Any&gt;&#39;, compiler/rustc_errors/src/lib.rs:945:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&amp;template=ice.md

note: rustc 1.49.0-dev running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [mir_borrowck] borrow-checking `foo::{constant#0}`
#1 [mir_drops_elaborated_and_const_checked] elaborating drops for `foo::{constant#0}`
end of query stack
error: aborting due to previous error
</code></pre></div>



<a name="213608313"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213608313" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213608313">(Oct 16 2020 at 20:09)</a>:</h4>
<p>the difference between the last two is <code>&amp;const{ ... }</code> vs <code>const{ &amp;...}</code> and returning <code>'static</code></p>



<a name="213608361"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213608361" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213608361">(Oct 16 2020 at 20:10)</a>:</h4>
<p>so the following error isn't emitted at all here?</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="n">error</span><span class="p">[</span><span class="n">E0015</span><span class="p">]</span>: <span class="nc">calls</span><span class="w"> </span><span class="k">in</span><span class="w"> </span><span class="n">constants</span><span class="w"> </span><span class="n">are</span><span class="w"> </span><span class="n">limited</span><span class="w"> </span><span class="n">to</span><span class="w"> </span><span class="n">constant</span><span class="w"> </span><span class="n">functions</span><span class="p">,</span><span class="w"> </span><span class="n">tuple</span><span class="w"> </span><span class="n">structs</span><span class="w"> </span><span class="n">and</span><span class="w"> </span><span class="n">tuple</span><span class="w"> </span><span class="n">variants</span><span class="w"></span>
<span class="w">  </span><span class="o">-</span>-&gt; <span class="nc">src</span><span class="o">/</span><span class="n">test</span><span class="o">/</span><span class="n">ui</span><span class="o">/</span><span class="n">inline</span><span class="o">-</span><span class="k">const</span><span class="o">/</span><span class="k">const</span><span class="o">-</span><span class="n">expr</span><span class="o">-</span><span class="n">reference</span><span class="p">.</span><span class="n">rs</span>:<span class="mi">12</span>:<span class="mi">12</span><span class="w"></span>
<span class="w">   </span><span class="o">|</span><span class="w"></span>
<span class="mi">12</span><span class="w"> </span><span class="o">|</span><span class="w">   </span><span class="k">const</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="o">&amp;</span><span class="n">bar</span><span class="p">()</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
<span class="w">   </span><span class="o">|</span><span class="w">            </span><span class="o">^^^^^</span><span class="w"></span>
</code></pre></div>



<a name="213608412"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213608412" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213608412">(Oct 16 2020 at 20:10)</a>:</h4>
<p>what do you mean by here?</p>



<a name="213608455"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213608455" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213608455">(Oct 16 2020 at 20:11)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116266">Santiago Pastorino</span> <a href="#narrow/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124/near/213606476">said</a>:</p>
<blockquote>
<div class="codehilite"><pre><span></span><code>[santiago@galago rust3 (const-exprs-rfc-2920|REBASE 7/10)]$ rustc +rust3-stage1 src/test/ui/inline-const/const-expr-reference.rs
error[E0015]: calls in constants are limited to constant functions, tuple structs and tuple variants
  --&gt; src/test/ui/inline-const/const-expr-reference.rs:12:12
   |
12 |   const { &amp;bar() }
   |            ^^^^^

error: internal compiler error: compiler/rustc_mir/src/borrow_check/universal_regions.rs:768:36: cannot convert `ReErased` to a region vid

thread &#39;rustc&#39; panicked at &#39;Box&lt;Any&gt;&#39;, compiler/rustc_errors/src/lib.rs:945:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
</code></pre></div>


</blockquote>
<p>is that error message outdated</p>



<a name="213608511"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213608511" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213608511">(Oct 16 2020 at 20:11)</a>:</h4>
<p>/does it actually refer to a different version of the first snippet where bar is not a <code>const fn</code></p>



<a name="213608539"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213608539" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213608539">(Oct 16 2020 at 20:11)</a>:</h4>
<p>ahh yes</p>



<a name="213608546"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213608546" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213608546">(Oct 16 2020 at 20:11)</a>:</h4>
<p>there's another version</p>



<a name="213608599"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213608599" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213608599">(Oct 16 2020 at 20:12)</a>:</h4>
<p>with const fn which gives the error you're saying now, yeah</p>



<a name="213608641"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213608641" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213608641">(Oct 16 2020 at 20:12)</a>:</h4>
<p>I guess ...</p>



<a name="213608663"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213608663" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213608663">(Oct 16 2020 at 20:12)</a>:</h4>
<ol>
<li>the E0015 error is ok but the thing shouldn't ICE</li>
</ol>



<a name="213608666"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213608666" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213608666">(Oct 16 2020 at 20:12)</a>:</h4>
<p>ah, so the only issue is on <code>const { &amp;value }</code> where we infer the lt of the reference from the outer context</p>



<a name="213608703"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213608703" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213608703">(Oct 16 2020 at 20:13)</a>:</h4>
<p>that is a bigger bug which I wouldn't try to fix before landing your pr</p>



<a name="213608704"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213608704" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213608704">(Oct 16 2020 at 20:13)</a>:</h4>
<ol start="2">
<li>the example without <code>const fn</code> should also be giving E0015</li>
</ol>



<a name="213608749"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213608749" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213608749">(Oct 16 2020 at 20:13)</a>:</h4>
<p><span class="user-mention silent" data-user-id="116266">Santiago Pastorino</span> <a href="#narrow/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124/near/213608704">said</a>:</p>
<blockquote>
<ol start="2">
<li>the example without <code>const fn</code> should also be giving E0015</li>
</ol>
</blockquote>
<p>what do you mean by this?</p>



<a name="213608926"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213608926" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213608926">(Oct 16 2020 at 20:15)</a>:</h4>
<p>what I was saying is ... first of all nothing should be ICEing, but that's obvious :)</p>



<a name="213608934"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213608934" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213608934">(Oct 16 2020 at 20:15)</a>:</h4>
<p>the other thing is</p>



<a name="213608943"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213608943" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213608943">(Oct 16 2020 at 20:15)</a>:</h4>
<p>I guess</p>



<a name="213608951"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213608951" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213608951">(Oct 16 2020 at 20:15)</a>:</h4>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="c1">// run-pass</span>

<span class="cp">#![feature(inline_const)]</span><span class="w"></span>

<span class="k">const</span><span class="w"> </span><span class="k">fn</span> <span class="nf">bar</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="kt">i32</span> <span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">const</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="mi">2</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="mi">3</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">foo</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="kp">&amp;</span><span class="o">'</span><span class="nb">static</span> <span class="kt">i32</span> <span class="p">{</span><span class="w"></span>
<span class="w">  </span><span class="k">const</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="o">&amp;</span><span class="n">bar</span><span class="p">()</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">assert_eq</span><span class="o">!</span><span class="p">(</span><span class="o">&amp;</span><span class="mi">5</span><span class="p">,</span><span class="w"> </span><span class="n">foo</span><span class="p">());</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">x</span>: <span class="kp">&amp;</span><span class="o">'</span><span class="nb">static</span> <span class="kt">i32</span> <span class="o">=</span><span class="w"> </span><span class="o">&amp;</span><span class="k">const</span><span class="p">{</span><span class="n">bar</span><span class="p">()};</span><span class="w"></span>
<span class="w">    </span><span class="n">assert_eq</span><span class="o">!</span><span class="p">(</span><span class="o">&amp;</span><span class="mi">5</span><span class="p">,</span><span class="w"> </span><span class="n">x</span><span class="p">);</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="213608961"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213608961" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213608961">(Oct 16 2020 at 20:15)</a>:</h4>
<p>should be giving an error like</p>



<a name="213608982"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213608982" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213608982">(Oct 16 2020 at 20:16)</a>:</h4>
<div class="codehilite"><pre><span></span><code>[santiago@galago rust3 (const-exprs-rfc-2920|REBASE 7/10)]$ rustc +rust3-stage1 src/test/ui/inline-const/const-expr-reference.rs
error[E0015]: calls in constants are limited to constant functions, tuple structs and tuple variants
  --&gt; src/test/ui/inline-const/const-expr-reference.rs:12:12
   |
12 |   const { &amp;bar() }
   |            ^^^^^
</code></pre></div>



<a name="213608996"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213608996" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213608996">(Oct 16 2020 at 20:16)</a>:</h4>
<p>without the ICE</p>



<a name="213609035"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213609035" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213609035">(Oct 16 2020 at 20:16)</a>:</h4>
<p>like the <code>const fn</code> version</p>



<a name="213609042"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213609042" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213609042">(Oct 16 2020 at 20:16)</a>:</h4>
<p>but why? <code>bar</code> is a <code>const fn</code></p>



<a name="213609172"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213609172" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213609172">(Oct 16 2020 at 20:17)</a>:</h4>
<p>I was thinking more about the <code>&amp;</code> than the <code>bar()</code> part</p>



<a name="213609238"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213609238" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213609238">(Oct 16 2020 at 20:18)</a>:</h4>
<p>but I guess it should be valid to return a reference</p>



<a name="213609370"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213609370" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213609370">(Oct 16 2020 at 20:19)</a>:</h4>
<p>simpler reproduction of the problem</p>



<a name="213609374"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213609374" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213609374">(Oct 16 2020 at 20:19)</a>:</h4>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="cp">#![feature(inline_const)]</span><span class="w"></span>

<span class="k">const</span><span class="w"> </span><span class="k">fn</span> <span class="nf">foo</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="kp">&amp;</span><span class="o">'</span><span class="nb">static</span> <span class="kt">i32</span> <span class="p">{</span><span class="w"></span>
<span class="w">  </span><span class="k">const</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="o">&amp;</span><span class="mi">5</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">assert_eq</span><span class="o">!</span><span class="p">(</span><span class="o">&amp;</span><span class="mi">5</span><span class="p">,</span><span class="w"> </span><span class="n">foo</span><span class="p">());</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="213609390"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213609390" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213609390">(Oct 16 2020 at 20:19)</a>:</h4>
<p>so about the ICE on <code>const { &amp;bar() }</code> I expect the error to be the following:</p>
<p>This is desugared to </p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">fn</span> <span class="nf">foo</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="kp">&amp;</span><span class="o">'</span><span class="nb">static</span> <span class="kt">i32</span> <span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">const</span><span class="w"> </span><span class="n">ANON_CONST_0</span>: <span class="kp">&amp;</span><span class="o">'?</span><span class="w"> </span><span class="kt">i32</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="o">&amp;'?</span><span class="w"> </span><span class="n">bar</span><span class="p">();</span><span class="w"></span>
<span class="w">    </span><span class="n">ANON_CONST_0</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>

<p>as we however need to infer the lifetime of the reference we would have to instead desugar this to</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">fn</span> <span class="nf">foo</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="kp">&amp;</span><span class="o">'</span><span class="nb">static</span> <span class="kt">i32</span> <span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">const</span><span class="w"> </span><span class="n">ANON_CONST_0</span>:<span class="o">&lt;'</span><span class="na">a</span><span class="o">&gt;</span><span class="w"> </span><span class="o">&amp;'</span><span class="na">a</span><span class="w"> </span><span class="kt">i32</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="o">&amp;'</span><span class="na">a</span><span class="w"> </span><span class="n">bar</span><span class="p">();</span><span class="w"></span>
<span class="w">    </span><span class="n">ANON_CONST_0</span>::<span class="o">&lt;'</span><span class="na">a</span><span class="o">&gt;</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="213609455"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213609455" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213609455">(Oct 16 2020 at 20:20)</a>:</h4>
<p>this is not quite trivial and also an issue for const generics</p>



<a name="213609536"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213609536" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213609536">(Oct 16 2020 at 20:21)</a>:</h4>
<p>cc <span class="user-mention" data-user-id="116118">@Matthew Jasper</span> who originally explained this to me quite a while ago, I just never got to actually implementing this</p>



<a name="213609564"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213609564" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213609564">(Oct 16 2020 at 20:21)</a>:</h4>
<p>yeah I don't understand this, would be nice if someone can explain it</p>



<a name="213609571"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213609571" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213609571">(Oct 16 2020 at 20:21)</a>:</h4>
<p>but again, the minimal example is</p>



<a name="213609585"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213609585" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213609585">(Oct 16 2020 at 20:21)</a>:</h4>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="cp">#![feature(inline_const)]</span><span class="w"></span>

<span class="k">const</span><span class="w"> </span><span class="k">fn</span> <span class="nf">foo</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="kp">&amp;</span><span class="o">'</span><span class="nb">static</span> <span class="kt">i32</span> <span class="p">{</span><span class="w"></span>
<span class="w">  </span><span class="k">const</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="o">&amp;</span><span class="mi">5</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">assert_eq</span><span class="o">!</span><span class="p">(</span><span class="o">&amp;</span><span class="mi">5</span><span class="p">,</span><span class="w"> </span><span class="n">foo</span><span class="p">());</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="213609588"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213609588" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213609588">(Oct 16 2020 at 20:21)</a>:</h4>
<p>which gives</p>



<a name="213609595"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213609595" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213609595">(Oct 16 2020 at 20:21)</a>:</h4>
<div class="codehilite"><pre><span></span><code>error: internal compiler error: compiler/rustc_mir/src/borrow_check/universal_regions.rs:768:36: cannot convert `ReErased` to a region vid

thread &#39;rustc&#39; panicked at &#39;Box&lt;Any&gt;&#39;, compiler/rustc_errors/src/lib.rs:945:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&amp;template=ice.md

note: rustc 1.49.0-dev running on x86_64-unknown-linux-gnu

query stack during panic:
#0 [mir_borrowck] borrow-checking `foo::{constant#0}`
#1 [mir_drops_elaborated_and_const_checked] elaborating drops for `foo::{constant#0}`
end of query stack
error: aborting due to previous error
</code></pre></div>



<a name="213609681"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213609681" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213609681">(Oct 16 2020 at 20:22)</a>:</h4>
<p>yeah, that should be exactly that issue. I think it's best to just ignore this for now</p>



<a name="213609733"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213609733" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lcnr <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213609733">(Oct 16 2020 at 20:23)</a>:</h4>
<p>To fix this, you can either wait for me to do it this once i finished my exams and am mentally well enough to dive into this or get <span class="user-mention" data-user-id="116118">@Matthew Jasper</span> to mentor here if they can.</p>



<a name="213610249"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213610249" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213610249">(Oct 16 2020 at 20:28)</a>:</h4>
<p><span aria-label="+1" class="emoji emoji-1f44d" role="img" title="+1">:+1:</span></p>



<a name="213610264"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213610264" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213610264">(Oct 16 2020 at 20:28)</a>:</h4>
<p>this PR is up with tests, with all the things addressed so should be ready to r+, cc <span class="user-mention" data-user-id="124288">@oli</span></p>



<a name="213610289"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213610289" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213610289">(Oct 16 2020 at 20:29)</a>:</h4>
<p>We can merge the PR even with that ICE, just mark the feature gate as incomplete so it gets the warning</p>



<a name="213610308"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213610308" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213610308">(Oct 16 2020 at 20:29)</a>:</h4>
<p>Lol I just caught up and was typing when you pinged me</p>



<a name="213610326"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213610326" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213610326">(Oct 16 2020 at 20:29)</a>:</h4>
<p><span class="user-mention" data-user-id="124288">@oli</span> told me to <code>r=oli-obk</code> but given that I've added more tests and stuff it may be good to review again I guess</p>



<a name="213610389"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213610389" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213610389">(Oct 16 2020 at 20:30)</a>:</h4>
<p><span class="user-mention silent" data-user-id="124288">oli</span> <a href="#narrow/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124/near/213610289">said</a>:</p>
<blockquote>
<p>We can merge the PR even with that ICE, just mark the feature gate as incomplete so it gets the warning</p>
</blockquote>
<p>ok, so last thing is to mark this as incomplete?</p>



<a name="213610409"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213610409" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213610409">(Oct 16 2020 at 20:30)</a>:</h4>
<p>Yes</p>



<a name="213610417"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213610417" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213610417">(Oct 16 2020 at 20:30)</a>:</h4>
<p><span aria-label="+1" class="emoji emoji-1f44d" role="img" title="+1">:+1:</span></p>



<a name="213610440"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213610440" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213610440">(Oct 16 2020 at 20:30)</a>:</h4>
<p>And then r=me</p>



<a name="213706865"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213706865" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213706865">(Oct 18 2020 at 13:39)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/pull/77124#issuecomment-711135046">https://github.com/rust-lang/rust/pull/77124#issuecomment-711135046</a></p>



<a name="213811573"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213811573" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213811573">(Oct 19 2020 at 16:31)</a>:</h4>
<p><span class="user-mention" data-user-id="123856">@Vadim Petrochenkov</span> <span aria-label="point up" class="emoji emoji-1f446" role="img" title="point up">:point_up:</span></p>



<a name="213811731"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213811731" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213811731">(Oct 19 2020 at 16:32)</a>:</h4>
<p>going to check the parser to see how to fix this but tips are welcome</p>



<a name="213812802"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213812802" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213812802">(Oct 19 2020 at 16:40)</a>:</h4>
<p>btw, the PR has landed :)</p>



<a name="213824052"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213824052" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213824052">(Oct 19 2020 at 18:10)</a>:</h4>
<p>Answered on the issue thread.</p>



<a name="213824059"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213824059" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213824059">(Oct 19 2020 at 18:10)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/issues/78108">https://github.com/rust-lang/rust/issues/78108</a></p>



<a name="213830924"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213830924" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213830924">(Oct 19 2020 at 19:08)</a>:</h4>
<p><span class="user-mention" data-user-id="123856">@Vadim Petrochenkov</span> you around?</p>



<a name="213830962"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213830962" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213830962">(Oct 19 2020 at 19:08)</a>:</h4>
<p>I can't make the end range parse</p>



<a name="213830988"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213830988" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213830988">(Oct 19 2020 at 19:08)</a>:</h4>
<p>the start expression works in the range with the code I've added</p>



<a name="213831011"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213831011" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213831011">(Oct 19 2020 at 19:08)</a>:</h4>
<p>but I was expecting this ...</p>



<a name="213831019"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213831019" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213831019">(Oct 19 2020 at 19:08)</a>:</h4>
<div class="codehilite" data-code-language="Diff"><pre><span></span><code>     fn parse_pat_range_end(&amp;mut self) -&gt; PResult&lt;'a, P&lt;Expr&gt;&gt; {
<span class="gd">-        if self.check_path() {</span>
<span class="gi">+        if self.check_inline_const() {</span>
<span class="gi">+            self.parse_const_expr(self.token.span)</span>
<span class="gi">+        } else if self.check_path() {</span>
</code></pre></div>



<a name="213831028"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213831028" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213831028">(Oct 19 2020 at 19:09)</a>:</h4>
<p>to make the trick</p>



<a name="213831181"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213831181" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213831181">(Oct 19 2020 at 19:10)</a>:</h4>
<p>ohh I see</p>



<a name="213831185"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213831185" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213831185">(Oct 19 2020 at 19:10)</a>:</h4>
<p>it works for this case</p>



<a name="213831188"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213831188" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213831188">(Oct 19 2020 at 19:10)</a>:</h4>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="w">    </span><span class="k">match</span><span class="w"> </span><span class="n">x</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="k">const</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">N</span><span class="w"> </span><span class="o">-</span><span class="w"> </span><span class="mi">1</span><span class="w"> </span><span class="p">}</span><span class="w"> </span><span class="o">..=</span><span class="w"> </span><span class="k">const</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">N</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="mi">1</span><span class="w"> </span><span class="p">}</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="p">{},</span><span class="w"></span>
<span class="w">        </span><span class="n">_</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="p">{},</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="213831208"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213831208" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213831208">(Oct 19 2020 at 19:10)</a>:</h4>
<p>but doesn't for</p>



<a name="213831211"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213831211" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213831211">(Oct 19 2020 at 19:10)</a>:</h4>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="w">    </span><span class="k">match</span><span class="w"> </span><span class="n">x</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="mi">1</span><span class="w"> </span><span class="o">..=</span><span class="w"> </span><span class="k">const</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">N</span><span class="w"> </span><span class="o">+</span><span class="w"> </span><span class="mi">1</span><span class="w"> </span><span class="p">}</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="p">{},</span><span class="w"></span>
<span class="w">        </span><span class="n">_</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="p">{},</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="213832063"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213832063" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213832063">(Oct 19 2020 at 19:17)</a>:</h4>
<p>fixed</p>



<a name="213832110"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213832110" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213832110">(Oct 19 2020 at 19:18)</a>:</h4>
<p>unsure if in the best way, opening a PR</p>



<a name="213832517"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213832517" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213832517">(Oct 19 2020 at 19:21)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/issues/78116">#78116</a></p>



<a name="213833846"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213833846" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213833846">(Oct 19 2020 at 19:33)</a>:</h4>
<p>what is exactly an <code>NtBlock</code>?</p>



<a name="213833883"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213833883" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213833883">(Oct 19 2020 at 19:33)</a>:</h4>
<p>non terminal block but unsure what's meant by non terminal there</p>



<a name="213835252"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213835252" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213835252">(Oct 19 2020 at 19:46)</a>:</h4>
<p>A non terminal is an already parsed thing instead of a bunch of raw tokens.</p>



<a name="213835322"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213835322" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213835322">(Oct 19 2020 at 19:46)</a>:</h4>
<p><a href="https://en.m.wikipedia.org/wiki/Parse_tree#Nomenclature">https://en.m.wikipedia.org/wiki/Parse_tree#Nomenclature</a></p>



<a name="213837514"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213837514" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213837514">(Oct 19 2020 at 20:03)</a>:</h4>
<p>can you give a concrete example?</p>



<a name="213837661"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213837661" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213837661">(Oct 19 2020 at 20:04)</a>:</h4>
<p><span class="user-mention" data-user-id="123856">@Vadim Petrochenkov</span> you were asking for a test here <a href="https://github.com/rust-lang/rust/pull/78118#discussion_r508027638">https://github.com/rust-lang/rust/pull/78118#discussion_r508027638</a></p>



<a name="213837690"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213837690" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213837690">(Oct 19 2020 at 20:04)</a>:</h4>
<p>I guess that's exactly what I was trying to ask here by a concrete example :)</p>



<a name="213837777"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213837777" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213837777">(Oct 19 2020 at 20:05)</a>:</h4>
<p>This happens when you do <code>$a:block</code> in a macro pattern matcher and then <code>$a</code> in the body.</p>



<a name="213838010"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213838010" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213838010">(Oct 19 2020 at 20:07)</a>:</h4>
<p>ya, that's what I was guessing</p>



<a name="213838014"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213838014" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213838014">(Oct 19 2020 at 20:07)</a>:</h4>
<p><span aria-label="+1" class="emoji emoji-1f44d" role="img" title="+1">:+1:</span></p>



<a name="213844831"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213844831" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213844831">(Oct 19 2020 at 20:58)</a>:</h4>
<p><span class="user-mention" data-user-id="123856">@Vadim Petrochenkov</span> the open range test fails</p>



<a name="213844926"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213844926" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213844926">(Oct 19 2020 at 20:58)</a>:</h4>
<p>taking a look at what could be the problem</p>



<a name="213846077"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213846077" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213846077">(Oct 19 2020 at 21:07)</a>:</h4>
<p>getting</p>



<a name="213846081"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213846081" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213846081">(Oct 19 2020 at 21:07)</a>:</h4>
<div class="codehilite"><pre><span></span><code>error: expected one of `=&gt;`, `if`, or `|`, found keyword `const`
  --&gt; /home/santiago/src/oss/rust1/src/test/ui/inline-const/const-match-pat-range.rs:25:12
   |
LL |         .. const { N + 1 } =&gt; {},
   |            ^^^^^ expected one of `=&gt;`, `if`, or `|`
</code></pre></div>



<a name="213846131"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213846131" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213846131">(Oct 19 2020 at 21:07)</a>:</h4>
<p>I guess this may be a check that I'm missing but unsure where is this happening</p>



<a name="213847994"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213847994" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213847994">(Oct 19 2020 at 21:21)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/pull/78116/files#diff-659e114fec89a1207d1dd2ceb40bcf6058d3e27dc5b6f529e22de5854b5f9d6dL294-L297">https://github.com/rust-lang/rust/pull/78116/files#diff-659e114fec89a1207d1dd2ceb40bcf6058d3e27dc5b6f529e22de5854b5f9d6dL294-L297</a></p>



<a name="213848104"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213848104" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213848104">(Oct 19 2020 at 21:22)</a>:</h4>
<p>This is where the check happens, but looks like you have already updated <code>is_pat_range_end_start</code>.</p>



<a name="213849539"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213849539" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213849539">(Oct 19 2020 at 21:36)</a>:</h4>
<p><span class="user-mention silent" data-user-id="123856">Vadim Petrochenkov</span> <a href="#narrow/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124/near/213847994">said</a>:</p>
<blockquote>
<p><a href="https://github.com/rust-lang/rust/pull/78116/files#diff-659e114fec89a1207d1dd2ceb40bcf6058d3e27dc5b6f529e22de5854b5f9d6dL294-L297">https://github.com/rust-lang/rust/pull/78116/files#diff-659e114fec89a1207d1dd2ceb40bcf6058d3e27dc5b6f529e22de5854b5f9d6dL294-L297</a></p>
</blockquote>
<p>the link doesn't take me to the place you're trying to point</p>



<a name="213849564"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213849564" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213849564">(Oct 19 2020 at 21:36)</a>:</h4>
<p><span class="user-mention silent" data-user-id="123856">Vadim Petrochenkov</span> <a href="#narrow/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124/near/213848104">said</a>:</p>
<blockquote>
<p>This is where the check happens, but looks like you have already updated <code>is_pat_range_end_start</code>.</p>
</blockquote>
<p>I see what's going on and I've fixed a part of the problem</p>



<a name="213849596"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213849596" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213849596">(Oct 19 2020 at 21:37)</a>:</h4>
<p>what's not working now is <code>const { } .. =&gt;</code></p>



<a name="213849623"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213849623" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213849623">(Oct 19 2020 at 21:37)</a>:</h4>
<p>because I'm doing ...</p>



<a name="213849629"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213849629" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213849629">(Oct 19 2020 at 21:37)</a>:</h4>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="w">        </span><span class="p">}</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="bp">self</span><span class="p">.</span><span class="n">check_inline_const</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">            </span><span class="c1">// Parse `const pat`</span>
<span class="w">            </span><span class="kd">let</span><span class="w"> </span><span class="n">const_expr</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="bp">self</span><span class="p">.</span><span class="n">parse_const_expr</span><span class="p">(</span><span class="n">lo</span><span class="p">.</span><span class="n">to</span><span class="p">(</span><span class="bp">self</span><span class="p">.</span><span class="n">token</span><span class="p">.</span><span class="n">span</span><span class="p">))</span><span class="o">?</span><span class="p">;</span><span class="w"></span>

<span class="w">            </span><span class="k">if</span><span class="w"> </span><span class="kd">let</span><span class="w"> </span><span class="nb">Some</span><span class="p">(</span><span class="n">re</span><span class="p">)</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="bp">self</span><span class="p">.</span><span class="n">parse_range_end</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">                </span><span class="kd">let</span><span class="w"> </span><span class="n">end</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="bp">self</span><span class="p">.</span><span class="n">parse_pat_range_end</span><span class="p">()</span><span class="o">?</span><span class="p">;</span><span class="w"></span>
<span class="w">                </span><span class="n">PatKind</span>::<span class="n">Range</span><span class="p">(</span><span class="nb">Some</span><span class="p">(</span><span class="n">const_expr</span><span class="p">),</span><span class="w"> </span><span class="nb">Some</span><span class="p">(</span><span class="n">end</span><span class="p">),</span><span class="w"> </span><span class="n">re</span><span class="p">)</span><span class="w"></span>
<span class="w">            </span><span class="p">}</span><span class="w"> </span><span class="k">else</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">                </span><span class="n">PatKind</span>::<span class="n">Lit</span><span class="p">(</span><span class="n">const_expr</span><span class="p">)</span><span class="w"></span>
<span class="w">            </span><span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="213849657"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213849657" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213849657">(Oct 19 2020 at 21:37)</a>:</h4>
<p>I should have a way to avoid the end part</p>



<a name="213849666"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213849666" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213849666">(Oct 19 2020 at 21:37)</a>:</h4>
<p>and pass <code>None</code></p>



<a name="213849722"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213849722" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213849722">(Oct 19 2020 at 21:38)</a>:</h4>
<p>I should just look ahead and try to see if there's <code>=&gt;</code>?</p>



<a name="213849733"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213849733" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213849733">(Oct 19 2020 at 21:38)</a>:</h4>
<p>seems a bit hacky to me</p>



<a name="213984570"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213984570" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213984570">(Oct 20 2020 at 21:56)</a>:</h4>
<p><span class="user-mention" data-user-id="123856">@Vadim Petrochenkov</span> you around?</p>



<a name="213984786"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213984786" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213984786">(Oct 20 2020 at 21:58)</a>:</h4>
<p>Not really, it's 1 AM here.</p>



<a name="213984806"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213984806" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213984806">(Oct 20 2020 at 21:58)</a>:</h4>
<p>I'll look tomorrow.</p>



<a name="213985974"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213985974" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213985974">(Oct 20 2020 at 22:10)</a>:</h4>
<p><span aria-label="+1" class="emoji emoji-1f44d" role="img" title="+1">:+1:</span></p>



<a name="213986003"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213986003" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213986003">(Oct 20 2020 at 22:11)</a>:</h4>
<p>about this <a href="https://github.com/rust-lang/rust/pull/78116#discussion_r508851636">https://github.com/rust-lang/rust/pull/78116#discussion_r508851636</a></p>



<a name="213986029"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213986029" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213986029">(Oct 20 2020 at 22:11)</a>:</h4>
<p>I'm getting</p>



<a name="213986037"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213986037" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213986037">(Oct 20 2020 at 22:11)</a>:</h4>
<div class="codehilite"><pre><span></span><code>error[E0029]: only `char` and numeric types are allowed in range patterns
  --&gt; /home/santiago/src/oss/rust1/src/test/ui/inline-const/const-match-pat-range.rs:35:13
   |
LL |         ..= const { .. } =&gt; {},
   |             ^^^^^ this is of type `RangeFull` but it should be `char` or numeric
</code></pre></div>



<a name="213986192"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213986192" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213986192">(Oct 20 2020 at 22:12)</a>:</h4>
<p>That seems correct, no? You have a range whose endpoint is another range. Unless that's supported and I haven't heard about it?</p>



<a name="213986888"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213986888" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213986888">(Oct 20 2020 at 22:20)</a>:</h4>
<p><span class="user-mention" data-user-id="307537">@Camelid</span> maybe I misunderstood <span class="user-mention" data-user-id="123856">@Vadim Petrochenkov</span>'s, unsure, but I'm not sure what's the test I need to add there</p>



<a name="213986965"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213986965" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213986965">(Oct 20 2020 at 22:21)</a>:</h4>
<p>I think he meant adding <code>..= const { FOO }</code> where <code>FOO</code> is some expression. <code>..</code> as in "fill in here"</p>



<a name="213987045"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213987045" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213987045">(Oct 20 2020 at 22:22)</a>:</h4>
<p><em>Not</em> <code>..</code> literally as <code>RangeFull</code></p>



<a name="213987066"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213987066" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213987066">(Oct 20 2020 at 22:22)</a>:</h4>
<p>yeah I wasn't unsure what was meant by <code>..</code> given that that test already exist</p>



<a name="213987069"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213987069" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213987069">(Oct 20 2020 at 22:22)</a>:</h4>
<p>the one you're saying</p>



<a name="213987076"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213987076" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213987076">(Oct 20 2020 at 22:22)</a>:</h4>
<p>unless I'm wrong ...</p>



<a name="213987080"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213987080" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213987080">(Oct 20 2020 at 22:22)</a>:</h4>
<p>checking again</p>



<a name="213987104"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213987104" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213987104">(Oct 20 2020 at 22:23)</a>:</h4>
<p>No, it didn't already exist from what I can tell <span aria-label="smile" class="emoji emoji-1f642" role="img" title="smile">:smile:</span></p>



<a name="213987114"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213987114" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213987114">(Oct 20 2020 at 22:23)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/pull/78116/files#diff-cb295c55e959e2598c6d596286bdc823edcc7ee3aa8e3d3a5318b2a699f83ea1R25">https://github.com/rust-lang/rust/pull/78116/files#diff-cb295c55e959e2598c6d596286bdc823edcc7ee3aa8e3d3a5318b2a699f83ea1R25</a></p>



<a name="213987116"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213987116" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213987116">(Oct 20 2020 at 22:23)</a>:</h4>
<p>This is the only one, and that's the one we were talking about: <a href="https://github.com/rust-lang/rust/pull/78116/files#diff-cb295c55e959e2598c6d596286bdc823edcc7ee3aa8e3d3a5318b2a699f83ea1R34-R37">https://github.com/rust-lang/rust/pull/78116/files#diff-cb295c55e959e2598c6d596286bdc823edcc7ee3aa8e3d3a5318b2a699f83ea1R34-R37</a></p>



<a name="213987125"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213987125" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213987125">(Oct 20 2020 at 22:23)</a>:</h4>
<p>ohh are we talking about <code>..</code> vs <code>..=</code> maybe?</p>



<a name="213987126"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213987126" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213987126">(Oct 20 2020 at 22:23)</a>:</h4>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="w">    </span><span class="k">match</span><span class="w"> </span><span class="n">x</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="o">..=</span><span class="w"> </span><span class="k">const</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="o">..</span><span class="w"> </span><span class="p">}</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="p">{},</span><span class="w"></span>
<span class="w">        </span><span class="n">_</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="p">{}</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
</code></pre></div>



<a name="213987135"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213987135" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213987135">(Oct 20 2020 at 22:23)</a>:</h4>
<p>Yes, I think so</p>



<a name="213987139"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213987139" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213987139">(Oct 20 2020 at 22:23)</a>:</h4>
<p><span aria-label="+1" class="emoji emoji-1f44d" role="img" title="+1">:+1:</span></p>



<a name="213987144"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213987144" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213987144">(Oct 20 2020 at 22:23)</a>:</h4>
<p>you're probably right</p>



<a name="213987150"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213987150" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213987150">(Oct 20 2020 at 22:24)</a>:</h4>
<p>I didn't think that test make sense</p>



<a name="213987176"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213987176" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213987176">(Oct 20 2020 at 22:24)</a>:</h4>
<p>but ...</p>



<a name="213987204"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213987204" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213987204">(Oct 20 2020 at 22:24)</a>:</h4>
<p>Well, you want to test as much as possible in the parser :)</p>



<a name="213987234"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213987234" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213987234">(Oct 20 2020 at 22:24)</a>:</h4>
<blockquote>
<p><strong>petrochenkov:</strong> [...] so all range code paths are covered?</p>
</blockquote>



<a name="213987305"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213987305" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213987305">(Oct 20 2020 at 22:25)</a>:</h4>
<p>But I understand how <code>..</code> meaning "elided" can be confusing when you're working with ranges</p>



<a name="213987366"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Inline%20const%20expressions%20%2377124/near/213987366" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Santiago Pastorino <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Inline.20const.20expressions.20.2377124.html#213987366">(Oct 20 2020 at 22:26)</a>:</h4>
<p>added those tests</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>